c++ - More than one construction matches argument list -
i tried compile vs2010
long long min = std::numeric_limits<int>::min(); unsigned long long max = std::numeric_limits<int>::max(); std::bitset<64> minimal(min);//here i'm getting error cout << "minimal: " << minimal;
error: error c2668: 'std::bitset<_bits>::bitset' : ambiguous call overloaded function 1> 1> [ 1> _bits=64 1> ] 1> c:\program files\microsoft visual studio 10.0\vc\include\bitset(136): 'std::bitset<_bits>::bitset(_ulonglong)' 1> 1> [ 1> _bits=64 1> ] 1> c:\program files\microsoft visual studio 10.0\vc\include\bitset(127): or 'std::bitset<_bits>::bitset(int)' 1> 1> [ 1> _bits=64 1> ] 1> while trying match argument list '(__int64)'
why? argument of long long type , constructor should used type. don't understand what's going on.
i don't see long long
1 of options you're given in list. see:
- _ulonglong
- int
- _int64
why don't cast min
unsigned long long
, see if fixes it. or better yet, use unsigned type - ever have bitset negative number of elements? :-)
Comments
Post a Comment