Boost logo

Boost :

Subject: Re: [boost] [align] Review - Design Evaluation.
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2014-04-12 05:28:31


On Sat, Apr 12, 2014 at 2:14 AM, Mostafa <mostafa_working_away_at_[hidden]> wrote:

Thank you! Some context regarding two concerns regarding design:

> IMO, "class aligned_allocator_adaptor : public Allocator" is a bad design.
> One, conceptually aligned_allocator_adaptor is not an "Allocator" because it
> overrides some of "Allocator"'s core functionality, and two, it enables the
> following surprising behaviour:

This design was chosen because it is the convention for allocator
adaptors, introduced into the C++ standard library in C++11 with
scoped_allocator_adaptor. (template <class OuterAlloc, class...
InnerAllocs> class scoped_allocator_adaptor : public OuterAlloc ...)

> template<class A> explicit aligned_allocator_adaptor(A&& alloc)
> Is this function intended to forward *any* single argument to the base class
> constructor? If so, then the argument name "alloc" is misleading and should
> be
> changed.

Similarly, chosen for consistency with the design established with
scoped_allocator_adaptor. (template <class OuterA2>
scoped_allocator_adaptor(OuterA2&& outerAlloc, const InnerAllocs&...
innerAllocs) ...)

Glen


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