This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Beginnings of std:forward_list


Hi,

and first, thanks for working on this...
2. I'm not sure I got the allocator technology right.
This area is new to me.
Actually, I think this is one of the most important issues, at the moment: unless I'm badly wrong (sorry in case), forward_list, like list and other containers, uses internally *two* different allocators, to allocate nodes and to allocate elements (to be precise, in current std::list they are _Node_alloc_type and _Tp_alloc_type). In our current, ABI-frozen, std::list, and I think in your prototype, we are storing only one of those allocators in the class, and constructing on the fly the other in case of need. That is in general suboptimal. Thus, when we are designing a new experimental container certainly we want to seriously deal with the issue: our specific approach we'll be useful for all the C++0x containers. The basic idea to implement it in a space efficient way is due to Howard Hinnant: he basically designed compressed_pair for that, to store efficiently, exploiting the empty base optimization, a *pair* of allocators. Therefore, I would suggest you starting from that, looking for that class (I think something is also in Boost, but then make sure to not plagiarize the actual code!), learn from it, play with it for forward_list (or a "mini" version of it, to begin)....

Then, there are of course other design decisions, which I consider less critical, at the moment...

Thanks,
Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]