Mail Archives: djgpp/1998/01/16/22:47:56
>Heh ?? Make your own container ?? Is that possible ? If so how would
>you start( is there some baseclass container ??).
It's quite possible; the key is to understand what functionality you really
want, and understand how that functionality gets it's functionality in the
first place. To code an STL container is really no different than coding any
other container. On the other hand, coding an STL container with as much
functionality as a standard STL container is another issue altogether. Where
to start? I'd say, first you'd need a real idea for a container that isn't
already supported (one such example is rope, defined in my SGI reference but
of course not in the gcc-STL) and decide how you'd implement it. Then take a
look at how another container, say vector<> is implemented. I'd suspect it's
a challenge but by no means impossible. I mean, we understand how iterators
work, right? It's a bit strange to understand the different types of
iterators and how they work, but once we have that, what else is there?
Keeping in mind that begin() and end() may not make sense in all cases and
are by no means mandatory, any templated container supporting different types
(but by no means all types) of iterators is really an STL container. Ahh,
actually it's not so hard after all, is it? (who am I trying to convince???)
Peach,
- Calvin -
- Raw text -