By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 888 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

How to extend the STL?

P: n/a
Hi all.

Can anyone give some good pointers or hyperlinks about how to 'extend' the
STL with my own datastructures?

For example, I'd like to add a disjoint set datastructure, but I don't know
how to use (derive from?) the std::iterator in my own class. Also, the stuff
with
allocators isn't entirely clear to me.

Does anybody know of any links which describe this sort of information about
the STL?

Thanks in advance,
Leon.
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Leon wrote:
Hi all.

Can anyone give some good pointers or hyperlinks about how to 'extend' the
STL with my own datastructures?

For example, I'd like to add a disjoint set datastructure, but I don't know
how to use (derive from?) the std::iterator in my own class. Also, the stuff
with
allocators isn't entirely clear to me.

Does anybody know of any links which describe this sort of information about
the STL?


I can suggest a book: The C++ Standard Library A Tutorial and Reference
by Nicolai M. Josuttis. ISBN: 0-201-37926-0

Section 7.5.2 "User-Defined Iterators" tells you what you want to know
and provides example code.

NR

Jul 19 '05 #2

P: n/a
Hi Leon,

I advice to study a good book on the STL. Personally I appreciate both
The C++ standard Library, A tutorial and reference by Josuttis
and
C++ templates The complete guide by Vandevoorde and Josuttis
very much. The first book will probably already get you there.

Cheers, Cees
Can anyone give some good pointers or hyperlinks about how to 'extend' the
STL with my own datastructures?

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.