gpt4 book ai didi

C++类型转换

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:12:25 24 4
gpt4 key购买 nike

我在哪里可以找到类型转换的概述,例如字符串到整数等?

鉴于到目前为止的评论,我将澄清:我正在寻找一个列表/表格,上面写着:要将字符串转换为 int,请使用: ... 对于其他数据类型(如果可能)也是如此:double 转换为 int,char 转换为 string,...

最佳答案

如果它是其他类型的字符串,那么 stringstreamboost::lexical_cast .

对于其他类型,这将取决于类型,但也许可以查看标准转换模板? static_castdynamic_cast应该做你需要的大部分事情,或者有 const_cast 和 reinterpret_cast 往往只对处理遗留系统有用。

关于C++类型转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2356268/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com