Boost logo

Boost :

Subject: Re: [boost] Request for help in porting colony to boost from experienced container boost dev
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2015-08-24 19:40:54

On Mon, Aug 24, 2015, Glen Fernandes wrote:
> Regarding your use of allocators in your implementation:
> a. Support the C++ allocator model
> 1. Either use a.allocate(size) or allocator_traits<A>::allocate(a,
> size, hint) if you want to supply a hint, but don't bother calling
> a.allocate(size, 0) - you alienate anyone who writes a C++11 allocator
> that may not provide an allocate(size, hint) member.
> 2. Use allocator_traits<A>::construct(a, ...) and
> allocator_traits<A>::destroy(a) instead of a.construct(...) and
> a.destroy(...)
> 3. Use allocator_traits<A> to obtain the type members (pointer, rebind, etc.)
> (You could use boost::allocator_traits if you want to support pre-C++11)
> b. Use a compressed_pair<> or the EBCO to reduce the storage for when
> stateless allocators are supplied (i.e. instead of the 1 + 1 bytes
> that would be used for the empty objects).
> c. Support element_type's whose constructor might throw: Do you catch,
> accordingly destroy any constructed elements, deallocate any allocated
> elements, before rethrowing?

d. Storage for 'elements' and 'erased' could probably be allocated
with a single allocation (instead of the two allocations presently).


Boost list run by bdawes at, gregod at, cpdaniel at, john at