【发布时间】:2010-10-12 02:39:23
【问题描述】:
static_cast 和 boost::shared_ptr 的等价物是什么?
也就是说,我要如何重写下面的内容
Base* b = new Derived();
Derived* d = static_cast<Derived*>(b);
当使用shared_ptr时?
boost::shared_ptr<Base> b(new Derived());
boost::shared_ptr<Derived> d = ???
【问题讨论】:
-
不应该是
Base *b = new Derived();吗?
标签: c++ boost shared-ptr static-cast