[libc++] use of allocator_traits

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[libc++] use of allocator_traits

Eric Fiselier via cfe-dev
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?

Cheers, Axel.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libc++] use of allocator_traits

Eric Fiselier via cfe-dev

On Thu, Apr 12, 2018 at 3:20 AM, Axel Naumann via cfe-dev <[hidden email]> 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 used
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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libc++] use of allocator_traits

Eric Fiselier via cfe-dev
On Fri, Apr 13, 2018 at 1:23 PM, Eric Fiselier via cfe-dev <[hidden email]> wrote:

On Thu, Apr 12, 2018 at 3:20 AM, Axel Naumann via cfe-dev <[hidden email]> 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 used
to deal with the custom allocator.

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


interesting. :-(

Please open a bug at bugs.llvm.org, and I'll look into it when I get back from the LLVM devcon.

-- Marshall



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libc++] use of allocator_traits

Eric Fiselier via cfe-dev
This appears to make allocator_traits not really fit for purpose, since extending the allocator interface is still a breaking change. :-(

On Fri, 13 Apr 2018, 22:34 Marshall Clow via cfe-dev, <[hidden email]> wrote:
On Fri, Apr 13, 2018 at 1:23 PM, Eric Fiselier via cfe-dev <[hidden email]> wrote:

On Thu, Apr 12, 2018 at 3:20 AM, Axel Naumann via cfe-dev <[hidden email]> 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 used
to deal with the custom allocator.

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


interesting. :-(

Please open a bug at bugs.llvm.org, and I'll look into it when I get back from the LLVM devcon.

-- Marshall


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libc++] use of allocator_traits

Eric Fiselier via cfe-dev
In reply to this post by Eric Fiselier via cfe-dev
On Fri, Apr 13, 2018 at 2:34 PM, Marshall Clow <[hidden email]> wrote:
On Fri, Apr 13, 2018 at 1:23 PM, Eric Fiselier via cfe-dev <[hidden email]> wrote:

On Thu, Apr 12, 2018 at 3:20 AM, Axel Naumann via cfe-dev <[hidden email]> 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 used
to deal with the custom allocator.

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


interesting. :-(

Please open a bug at bugs.llvm.org, and I'll look into it when I get back from the LLVM devcon.


I guess the good news is that those calls are only used in <vector>

-- Marshall
 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev