|
Boost : |
Subject: Re: [boost] Proposal: Monotonic Containers - Comparison with boost::pool, boost::fast_pool and TBB
From: Christian Schladetsch (christian.schladetsch_at_[hidden])
Date: 2009-06-23 22:40:29
[snip]
>
> Christian> This invalidates the use of stateful allocators, because it is
>> making
>> multiple temporary lists that do not use the allocator that the parent
>> container was supplied with.
>>
>
> Steven> No it doesn't. Boost.Intrusive doesn't allocate anything.
> All that sort does is to rearrange existing nodes, so the allocator
> is not needed. Boost.Intrusive doesn't even know that
> an allocator exists.
I stand corrected - I just saw that interprocess::list<> used the same
algorithm as MSVC, including the temporary default-constructed lists
(without passing the allocator). I did not follow it through to realise that
unlike the MSVC implementation, Boost.Intrusive does not do any allocation.
The following works on MSVC and GCC:
monotonic::storage<> storage;
{
interprocess::list<int, monotonic::allocator<int> > list(storage);
generate_n(back_inserter(list), 10, rand);
list.sort();
}
I'll happily base my containers on interprocess::containers rather than
std::containers.
What do people think of moving boost::interprocess::containers to
boost::containers? These containers are not really specific to interprocess?
Thanks,
Christian.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk