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

Shafik Yaghmour via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 14 17:34:52 PST 2017


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

    https://stackoverflow.com/q/31974237/1708801

Regards
  Shafik

> On Nov 14, 2017, at 5:28 PM, Eric Fiselier via cfe-dev <cfe-dev at lists.llvm.org> 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 <hubert.reinterpretcast at gmail.com <mailto:hubert.reinterpretcast at gmail.com>> wrote:
> On Tue, Nov 14, 2017 at 6:13 PM, Eric Fiselier via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> Unless I'm mis-reading the spec, `vector<bool>::const_reference` is implementation defined. Not bool. See [vector.bool] <http://eel.is/c++draft/vector.bool>.
> It says: 
> using const_reference        = bool;
> 
>  
> 
> /Eric
> 
> On Tue, Nov 14, 2017 at 6:39 AM, Mikhail Maltsev via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> 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
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
> 
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
> 
> 
> 
> _______________________________________________
> 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/20171114/0f6a0d20/attachment-0001.html>


More information about the cfe-dev mailing list