Boost logo

Boost :

Subject: Re: [boost] [container] New container: why is everybody silent?
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2014-08-12 00:23:45


On Mon, Aug 11, 2014 at 8:52 AM, Aleksandr Kupriianov
<alexkupri_at_[hidden]> wrote:
> All requirements fulfilled: documentation, license, c++11, warnings suppressed.
> http://alexkupri.github.io/array/

It does not yet support the C++11 allocator model. Some changes required:

1. Do not call .construct or .destroy directly, but only via
std::allocator_trails
   Note: If you want to support both C++11 and C++03 compilers then do
this when BOOST_NO_CXX11_ALLOCATOR is _not_ defined - and when it is
defined, use placement new for construction
   Note: Do this only for construction of value_type objects; for all
other construction use placement new

2. Do not use the ::pointer member types of the allocator type
directly. Use std::allocator_traits to obtain these types.

3. A C++11 allocator's 'pointer' type may not be a raw pointer, so do
not make that assumption. p = a.allocate(n); - p should be the
allocator's ::pointer type. If you need a raw pointer from it,
std::addressof(*p) will get you that address - but preserve the value
of p for as long as you keep that address around, because p is what
you will give back to .deallocate().

Note: Both std::addressof and std::allocator_traits mentioned have
Boost equivalents; boost::addressof and boost::allocator_traits; if
you want to avoid the BOOST_NO_CXX11_* checks and conditional code for
each.

Glen


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk