H
Hunter Hou
Hello,
I have this very simple program, but it can't be compiled. What's wrong
here?
thanks,
hunter
#include <iostream>
#include <bitset>
int main()
{
std::bitset<6> b1("101010");
std::cout << b1 << std::endl;
return 0;
}
The error is:
bitset.cpp: In function `int main()':
bitset.cpp:8: invalid conversion from `const char*' to `long unsigned int'
bitset.cpp:8: initializing argument 1 of `std::bitset<_Nb>::bitset(long
unsigned int) [with unsigned int _Nb = 6]'
Compiler says can't convert, but bitset<> has such an explicit constructor.
P.S. > If I use default constructor, everything is fine.
I have this very simple program, but it can't be compiled. What's wrong
here?
thanks,
hunter
#include <iostream>
#include <bitset>
int main()
{
std::bitset<6> b1("101010");
std::cout << b1 << std::endl;
return 0;
}
The error is:
bitset.cpp: In function `int main()':
bitset.cpp:8: invalid conversion from `const char*' to `long unsigned int'
bitset.cpp:8: initializing argument 1 of `std::bitset<_Nb>::bitset(long
unsigned int) [with unsigned int _Nb = 6]'
Compiler says can't convert, but bitset<> has such an explicit constructor.
P.S. > If I use default constructor, everything is fine.