本文共 317 字,大约阅读时间需要 1 分钟。
#include#include int main () { std::shared_ptr foo; std::shared_ptr bar; foo = std::make_shared (10); bar = std::const_pointer_cast (foo); std::cout << "*bar: " << *bar << '\n'; *foo = 20; std::cout << "*bar: " << *bar << '\n'; return 0;}
转载地址:http://maxdi.baihongyu.com/