[cfe-dev] [libc++] use of allocator_traits

Eric Fiselier via cfe-dev cfe-dev at lists.llvm.org
Fri Apr 13 13:23:42 PDT 2018

On Thu, Apr 12, 2018 at 3:20 AM, Axel Naumann via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi,
> I'm confused by libc++'s use of allocator_traits, for instance in
> vector:898:
>     __alloc_traits::__construct_backward(this->__alloc(),
> this->__begin_, this->__end_, __v.__begin_);
> The standard seems to not require the existence of a member called
> __construct_backward. Seemingly standard-conforming, user provided
> specializations of this trait (for a user provided allocator) thus fail
> to compile.
> Am I misinterpreting allocator_trait as a customization point?

I would have thought so, because my understanding was that the allocator
was the customization point, where as allocator_traits was the interface
to deal with the custom allocator.

However, the standard seems to disagree with me, noting that users
may specialize `allocator_traits`.

> Cheers, Axel.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180413/58c095dc/attachment.html>

More information about the cfe-dev mailing list