How to extend the STL?

Discussion in 'C++' started by Leon, Aug 6, 2003.

  1. Leon

    Leon Guest

    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.
    Leon, Aug 6, 2003
    #1
    1. Advertising

  2. Leon

    Noah Roberts Guest

    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
    Noah Roberts, Aug 6, 2003
    #2
    1. Advertising

  3. 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?
    Cees Wesseling, Aug 6, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Allan Bruce

    To STL or not to STL

    Allan Bruce, Oct 16, 2003, in forum: C++
    Replies:
    41
    Views:
    1,005
    Christopher Benson-Manica
    Oct 17, 2003
  2. Replies:
    4
    Views:
    776
    Daniel T.
    Feb 16, 2006
  3. Replies:
    2
    Views:
    534
    klaus hoffmann
    Feb 22, 2006
  4. Replies:
    5
    Views:
    488
    Markus Schoder
    Apr 16, 2006
  5. Steve
    Replies:
    2
    Views:
    490
    Andre Kostur
    Nov 6, 2007
Loading...

Share This Page