How to extend the STL?

L

Leon

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.
 
N

Noah Roberts

Leon said:
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
 
C

Cees Wesseling

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top