by Pete Becker <pete@[EMAIL PROTECTED]
>
May 6, 2008 at 07:14 AM
On 2008-05-06 07:02:00 -0400, mathieu <mathieu.malaterre@[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);
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)