New const char* ctor for C++-0x

Paolo Carlini paolo.carlini@oracle.com
Wed Dec 23 10:41:00 GMT 2009


On 12/23/2009 10:44 AM, Jonathan Wakely wrote:
> #include <bitset>
> struct X {
>   operator const char* () { return "10101010"; }
> };
>
> int main()
> {
>   X x;
>   std::string s(x);
>   std::bitset<32> b1(x);
>   std::bitset<32> b2(s);
>   VERIFY( b1 == b2 );
> }
>
> With your patch applied this passes in c++0x mode, but not otherwise.
>   
Good idea. Eventually, let's also remember to remove from the patch that
damn size_t __len = 0;

Paolo.



More information about the Libstdc++ mailing list