taglib fails to compile with MS VC++ 2010
Tanguy Krotoff
tkrotoff at gmail.com
Fri Jan 21 13:05:24 CET 2011
** Summary: yes this patch is perfect! it makes the code compliant
with the new version C++0x (still to be released)
** More details:
The error simplified is:
mpegheader.cpp(172) : error C2668: 'std::bitset<_Bits>::bitset' :
ambiguous call to overloaded function
C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\bitset(136):
could be 'std::bitset<_Bits>::bitset(_ULonglong)'
C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\bitset(127):
or 'std::bitset<_Bits>::bitset(int)'
while trying to match the argument list '(TagLib::uint)'
This is Visual C++ 2008 bitset constructor:
http://msdn.microsoft.com/en-us/library/zfae7kt8(v=VS.90).aspx
bitset(
unsigned long _Val
);[...]
This is Visual C++ 2010 bitset constructor:
http://msdn.microsoft.com/en-us/library/zfae7kt8(v=VS.100).aspx
bitset(
unsigned long long _Val
);
This is a change due to the new C++ version C++0x (still to be
released...) cf bitset source code from Visual C++ 2010 on my hard
drive (see http://www.codeguru.com/cpp/article.php/c18259 for more
explanations about _HAS_CPP0X):
[...]
#if _HAS_CPP0X
bitset(int _Ival) <-------- line 127
{ // construct from bits in int
unsigned int _Val = (unsigned int)_Ival;
_Tidy();
for (size_t _Pos = 0; _Val != 0 && _Pos < _Bits; _Val >>= 1, ++_Pos)
if (_Val & 1)
set(_Pos);
}
bitset(_ULonglong _Val) <-------- line 136
#else /* _HAS_CPP0X */
bitset(unsigned long _Val)
#endif /* _HAS_CPP0X */
[...]
More explanations about this change in C++0x :
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2795.html#694
"[...]replace the bitset ctor that takes an unsigned long argument
with one taking unsigned long long in the definition of the template"
2011/1/16 Lukáš Lalinský <lalinsky at gmail.com>:
> On Fri, Jan 14, 2011 at 11:05 AM, Tanguy Krotoff <tkrotoff at gmail.com> wrote:
>> Hi everybody.
>>
>> Any chance to get this patch on trunk?
>
> I'll commit it, but can somebody please explain to me why is it
> necessary to cast the value to "unsigned long long". From what I can
> see, the std::bitset class has only "unsigned long" constructor.
> Shouldn't it be casted to "unsigned long" instead?
>
> Lukas
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>
More information about the taglib-devel
mailing list