C ++ 11 to_string()函数,其中? [英] C++11 to_string() function, where?

查看:69
本文介绍了C ++ 11 to_string()函数,其中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅 N3242 C ++ 11工作草案,第21.5章数值转换。

See the N3242 Working Draft of C++11, chapter 21.5 Numeric Conversions.

有一些有用的函数,例如 string to_string(int val); 但我不明白他们是怎么叫的。

There are some useful functions, such as string to_string(int val); mentioned but I don't understand how they're called. Can anyone give me an example please?

推荐答案

这些函数位于< string> / code>。您只需像任何其他函数一样调用它们:

Those functions are in the header <string>. You just call them like any other function:

#include <string>
std::string answer = std::to_string(42);

GCC 4.5 已支持函数,您只需要使用 -std = c ++ 0x 标志进行编译。

GCC 4.5 already supports those functions, you just need to compile with the -std=c++0x flag.

这篇关于C ++ 11 to_string()函数,其中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆