【问题标题】:More than one instance of overloaded function to_string matches the argument list多个重载函数 to_string 实例与参数列表匹配
【发布时间】:2016-02-26 04:06:27
【问题描述】:

我完全按照这里写的:Easiest way to convert int to string in C++

但我在 std::to_string 的 std 处收到错误

#include <iostream>
#include <string>

int main()
{

std::string s = std::to_string(42);

return 0;
}

【问题讨论】:

标签: c++


【解决方案1】:

无法为符合标准的库实现生成您收到的错误消息。

所以,最好的解决方案是升级编译器(大概是几年前的 Visual C++)。

另一种方法是使用long 类型的参数,并希望这是现有的重载之一:

std::to_string( 42L )

【讨论】:

    猜你喜欢
    • 2012-05-26
    • 2012-10-12
    • 2021-10-11
    • 1970-01-01
    • 1970-01-01
    • 2012-03-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多