Re: stl help needed
On Oct 30, 12:08 am, Juha Nieminen <nos...@thanks.invalid> wrote:
DJ Dharme wrote:
I really like to use stl as much as possible in my code. But
I found it really hard to understand by looking into there
source code. I have no idea about what iterator traits,
heaps and allocators are.
You don't need to know what iterator traits, heaps or
allocators are in order to *use* the STL (which is what you
are saying above).
Or do you mean that you want to create your own data container
which works in the same way as the standard library data
containers?
Isn't this really mainly an issue of providing standard
conformant iterators? I know that the standard does specify a
certain number of container requirements, but I don't see any
place in the standard which depends on them being implemented in
other containers. All of the use of arbitrary containers in the
standard is via iterators. (Almost---the container adapters
would be an exception.)
At any rate, if I were implementing a standard-like container,
I'd certainly concentrate on making the iterators conform. I'd
throw in the relevant typedef's, and use the same names for the
member functions, because that doesn't cost anything; I'd even
model my choice of functions after the standard, providing not
just insert() and erase(), but push_back(), for example, and
back() and front(), if relevant. But I wouldn't waste my time
worrying about allocators, and providing an allocator template
parameter. (For that matter, I'm not alone, since the next
version of the standard will have std::array, which won't have
an allocator either.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34