朱顶红休眠期:std::bitset<size>::to_string()的疑问

来源:百度文库 编辑:高校问答 时间:2024/04/24 21:16:34
std::bitset<size>::to_string()的疑问

#include <bitset>
#include <iostream>
using namespace std;
int main(void)
{
bitset<8> b(1);
cout << b.to_string();
}
2005Express下通过,MinGW下却说:
no matching function for call to `std::bitset<8>::to_string()'
号称Designed for STL的MinGW太让我失望了
STL达人指点一下这其中的玄机.

如果b 是bitset,你不能只是写:
std::string s = b.to_string();
你必须改用这种形式:
std::string s = b.template to_string<char,std::char_traits<char>,std::allocator<char> >();
http://blog.csdn.net/xueerfei008/article/details/9371377