【发布时间】:2023-03-06 21:53:01
【问题描述】:
我需要在我的代码中从 shared_ptr 获取 auto_ptr。我可以做反向操作 - 将 auto_ptr 转换为 shared_ptr 因为 shared_ptr 有这样的构造函数:
template<class Y> explicit shared_ptr(std::auto_ptr<Y> & r);
我可以将 shared_ptr 转换为 auto_ptr 吗?还是设计上不可能?
【问题讨论】:
标签: c++ shared-ptr auto-ptr