Boost logo

Boost :

Subject: Re: [boost] [cpo-proposal] presentation of the idea
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2013-08-17 08:12:48

On Aug 16, 2013, at 9:21 AM, Santiago Tapia <santiago.tapia_at_[hidden]> wrote:

>> Date: Tue, 13 Aug 2013 23:33:25 +0400
>> From: Andrey Semashev <andrey.semashev_at_[hidden]>
>>> - The allocator argument in the classifier will be applied to every object added to the classifier. Thus, the allocator is provided without its argument. The std::allocator is the default argument.
>> You can use the standard interface for allocator rebinding:
>> typedef allocator<T> allocator_T;
>> typedef typename allocator_T::template rebind<U>::other allocator_U;
>> You can use std::allocator<void> by default then.
> I am not sure how to do this. I need a allocator with a parameter in order to get: allocator<triangle>, allocator<square>, ... this allocator must be instantiated when an object of a new class is inserted in the classifier.

That's the point of rebind. Starting with allocator<A>, you can get allocator<B>. The spelling of allocator<B> just looks odd:

typename allocator<A> template ::rebind<B>::other


(Sent from my portable computation engine)

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