
Compiler Error C2783 when using Bitsets.
Quote:
> I tried compiling the following code in VC++7.0
> #define MAX_VAL 16
> typedef std::bitset<MAX_VAL> MyBitSet;
> class CMyClass
> {
> MyBitSet m_Values;//bitset
> };
> void CMyClass::Test()
> {
> string s = m_Values.to_string();//to check the value in the bitset
> }
> When compiling the above line the compiler gives my Compiler error C2783,
> could not deduce template argument for '<_bitset 16>'
> I made a search on this error in MSDN, it says that this issue exists in
> earlier versions of VC++ and was corrected in VC++6.0.
> Can any one let me know why am I facing this error in VC++7.0?
> How can I get rid of this error, in the above case?
You have to call to_string as to_string<char, std::char_traits<char>,
std::allocator<char>(). This is not a bug in this implementation, but a
feature of the language that found its way into bitset, which was
standardized before it was ever implemented.
V6.0 has trouble with function calls of the form f<type>(args), but V7.0
does not.
P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com