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:37:35


On Mon, Aug 24, 2015, [Matt] wrote:
> It is an incomplete port but functional.
> I posted to the boost-users list about colony previously, if anyone is
> unsure about what it is please see the website (plflib.org) for benchmarks,
> overview reasoning and code-

Matt,

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?

Best,
Glen