by mathieu <mathieu.malaterre@[EMAIL PROTECTED]
>
May 6, 2008 at 04:52 AM
On May 6, 1:14 pm, Pete Becker <p...@[EMAIL PROTECTED]
> wrote:
> On 2008-05-06 07:02:00 -0400, mathieu <mathieu.malate...@[EMAIL PROTECTED]
>
said:
>
> > #include <bitset>
> > #include <iostream>
> > #include <string>
>
> > int main()
> > {
> > std::bitset<8> ref( 13ul );
> > std::cout << ref << std::endl;
>
> > const char v[] = "1101";
> > std::bitset<8> mask( std::string(v) );
> > std::cout << mask << std::endl;
> > return 0;
> > }
>
> You've stepped into a funky corner of C++ syntax. This code declares
> mask to be a function, and the compiler converts its address to a bool
> to insert it into a stream. Break up the definition of mask:
>
> std::string str(v);
> std::bitset<8> mask(str);
Thanks ! That was it.