在libstdc ++中使用std :: to_wstring?

Kim*_*imi 1 c++ gcc libstdc++ c++11

为什么这不能在gcc上编译?

#include <iostream>
#include <string>

int main() {

    double f = 23.43;    
    std::wstring f_str = std::to_wstring(f);
    std::wcout << f_str << std::endl;

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

错误:

prog.cpp:在函数'int main()'中:

prog.cpp:6:26:错误:'to_wstring'不是'std'的成员

hmj*_*mjd 5

std::to_wstring()在C++ 11中添加了.你的答案中的链接,在ideone上,没有使用C++ 11编译器:

语言:C++(gcc-4.7.2)

它编译得很好:http://ideone.com/UO2FQM:

语言:C++ 0x(gcc-4.7.2)