[libc++] Why doesn't libc++ define std::vector<bool>::const_reference as bool?

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

[libc++] Why doesn't libc++ define std::vector<bool>::const_reference as bool?

Alex Denisov via cfe-dev
Hi. According to the C++ Standard (section [vector.bool]), std::vector<bool>::const_reference should be defined as bool. libc++ defines it as std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>>]. Is this divergence from the standard intentional? If it is, what is the purpose?

--
Regards,
   Mikhail Maltsev

_______________________________________________
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++] Why doesn't libc++ define std::vector<bool>::const_reference as bool?

Alex Denisov via cfe-dev
Unless I'm mis-reading the spec, `vector<bool>::const_reference` is implementation defined. Not bool. See [vector.bool].

/Eric

On Tue, Nov 14, 2017 at 6:39 AM, Mikhail Maltsev via cfe-dev <[hidden email]> wrote:
Hi. According to the C++ Standard (section [vector.bool]), std::vector<bool>::const_reference should be defined as bool. libc++ defines it as std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>>]. Is this divergence from the standard intentional? If it is, what is the purpose?

--
Regards,
   Mikhail Maltsev

_______________________________________________
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++] Why doesn't libc++ define std::vector<bool>::const_reference as bool?

Alex Denisov via cfe-dev
On Tue, Nov 14, 2017 at 6:13 PM, Eric Fiselier via cfe-dev <[hidden email]> wrote:
Unless I'm mis-reading the spec, `vector<bool>::const_reference` is implementation defined. Not bool. See [vector.bool].
It says:
using const_reference        = bool;

 

/Eric

On Tue, Nov 14, 2017 at 6:39 AM, Mikhail Maltsev via cfe-dev <[hidden email]> wrote:
Hi. According to the C++ Standard (section [vector.bool]), std::vector<bool>::const_reference should be defined as bool. libc++ defines it as std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>>]. Is this divergence from the standard intentional? If it is, what is the purpose?

--
Regards,
   Mikhail Maltsev

_______________________________________________
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



_______________________________________________
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++] Why doesn't libc++ define std::vector<bool>::const_reference as bool?

Alex Denisov via cfe-dev
Looking again, it seems like a libc++ bug. Not sure if Howard intended to be non-conforming here, but it's likely a mistake.

Feel free to file a bug.

/Eric

On Tue, Nov 14, 2017 at 4:20 PM, Hubert Tong <[hidden email]> wrote:
On Tue, Nov 14, 2017 at 6:13 PM, Eric Fiselier via cfe-dev <[hidden email]> wrote:
Unless I'm mis-reading the spec, `vector<bool>::const_reference` is implementation defined. Not bool. See [vector.bool].
It says:
using const_reference        = bool;

 

/Eric

On Tue, Nov 14, 2017 at 6:39 AM, Mikhail Maltsev via cfe-dev <[hidden email]> wrote:
Hi. According to the C++ Standard (section [vector.bool]), std::vector<bool>::const_reference should be defined as bool. libc++ defines it as std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>>]. Is this divergence from the standard intentional? If it is, what is the purpose?

--
Regards,
   Mikhail Maltsev

_______________________________________________
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




_______________________________________________
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++] Why doesn't libc++ define std::vector<bool>::const_reference as bool?

Alex Denisov via cfe-dev
Actually Howard explains this non-conformance in a self answer Stackoverflow question "Why is libc++'s vector<bool>::const_reference not bool?”:


Regards
  Shafik

On Nov 14, 2017, at 5:28 PM, Eric Fiselier via cfe-dev <[hidden email]> wrote:

Looking again, it seems like a libc++ bug. Not sure if Howard intended to be non-conforming here, but it's likely a mistake.

Feel free to file a bug.

/Eric

On Tue, Nov 14, 2017 at 4:20 PM, Hubert Tong <[hidden email]> wrote:
On Tue, Nov 14, 2017 at 6:13 PM, Eric Fiselier via cfe-dev <[hidden email]> wrote:
Unless I'm mis-reading the spec, `vector<bool>::const_reference` is implementation defined. Not bool. See [vector.bool].
It says:
using const_reference        = bool;

 

/Eric

On Tue, Nov 14, 2017 at 6:39 AM, Mikhail Maltsev via cfe-dev <[hidden email]> wrote:
Hi. According to the C++ Standard (section [vector.bool]), std::vector<bool>::const_reference should be defined as bool. libc++ defines it as std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>>]. Is this divergence from the standard intentional? If it is, what is the purpose?

--
Regards,
   Mikhail Maltsev

_______________________________________________
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



_______________________________________________
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