Boost logo

Boost :

Subject: Re: [boost] [Root Pointer] Benchmark
From: Phil Bouchard (philippeb8_at_[hidden])
Date: 2016-03-15 20:58:25


On 03/15/2016 08:40 PM, Glen Fernandes wrote:
>
> I think you do not understand the allocator model. 'const A&' is fine
> for the allocator argument.

Yes you're right. I need to make my references const.

> std::vector<T, A>'s constructors have a 'const A&' parameter.
> std::allocate_shared<T, A, Args...> takes a 'const A&' parameter.
> std::function's function<A> constructor takes a 'const A&' parameter.
>
> All of the above copy-initialize an A instance from the given
> parameter, and would thus have a non-const A instance on which to call
> allocate(), et cetera.
>
> The way that the stateful allocators would be designed is such that
> they all reference the same shared state (similar to 'Allocator' in
> that example.cpp I gave you).

Thanks for the clarifications.


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