ruoshan 最近的时间轴更新
ruoshan

ruoshan

V2EX 第 45954 号会员,加入于 2013-09-25 17:06:11 +08:00
ruoshan 最近回复了
2019-07-04 18:45:49 +08:00
回复了 fetich 创建的主题 C++ 请教《C++ Primer》一书中有关显式类型转换的问题
string 的构造函数有一个是这个:
`basic_string( const CharT* s, const Allocator& alloc = Allocator() );`

static_cast<std::string>(cp) 和 std::string(cp) 是一样的效果.

你可以编译一下 `g++ -std=c++11 -g -S x.cc` 看一下 `x.s`. 他们两个编译出来的代码是一样的.
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2495 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 06:36 · PVG 14:36 · LAX 23:36 · JFK 02:36
Developed with CodeLauncher
♥ Do have faith in what you're doing.