From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-03-22 17:35:03
Dave Harris wrote:
> In-Reply-To: <46001891.5080209_at_[hidden]>
> igaztanaga_at_[hidden] (=?ISO-8859-1?Q?Ion_Gazta=F1aga?=) wrote (abridged):
>> Sink sounds good but now I need a name for operations:
> I would be tempted by:
> leaving open what the passed functor was expected to do. Alternatively:
> because for me "dispose" is a less committed word than "destroy". It still
> has the connotation that the container is getting rid of them, but leaves
> it more open as to what that entails. "Dispose" does have a more specific
> meaning in garbage collection circles; I don't know if that would be a
> problem here.
Now I need a new for the function object (disposer? ;-))
> I don't know; it's just something which surprised me. Do other people
> think ilist is closer to list<T> or list<T*>?
For the moment I think people like the current interface.
>> Well, comparing sizes of STL containers is a bit misleading, because
>> how many bytes are we supposed to use in memory bookeeping if we use
>> standard allocators?
> I'd say none. For example, I believe the overhead for a std::slist<T*>
> node is 2 pointers, half that of ilist<T>.
I suppose you mean std::list (slist is not an standard container).
In both cases you need to allocate T. For std::list T's size is A. For
ilist T's size is A + 2 pointers. Now you need std::list<T*> with
overhead of a node with 3 pointers (T*, a pointer to the next node and a
pointer the previous node). This node is allocated dynamically, which
typically has a memory allocation header (typical figure 8 bytes in 32
bytes, unless a pool is used). 2 pointers versus 3 pointers + allocation
An intrusive containers will _always_ be more space efficient than a
non-intrusive one. I'll try to explain this in the documentation.
> -- Dave Harris, Nottingham, UK.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk