This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [GSoC] __enable_shared_from_this_helper


On Thu, Apr 30, 2015 at 4:23 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
> On 29/04/15 20:28 -0700, Tim Shen wrote:
>>
>> Is it still as usable if we do a rebind here? [17.6.3.5] seems to make
>> rebind optional, and there may not exist a char allocator. This was my
>> major concern.
>
>
> All allocators must support rebinding. If they don't provide a rebind
> member then allocator_traits will provide it, and if that doesn't work
> it's ill-formed and the allocator can't be used with allocate_shared.

Never mind, I misunderstood the allocator requirement; it's not optional.

> Allocators are allowed to restrict the types they can be instantiated
> with, so Alloc<char>::allocate() or Alloc<char>::deallocate() might
> fail to compile, but that's not our problem. Users who define
> allocators like that can't use them with allocate_shared<T[]>.

This is why I was asking "still as usable". This feature actually
requires more from the user, since standard didn't specify more.

Anyway, we don't need to worry about this for now.


-- 
Regards,
Tim Shen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]