![](/img/trans.png)
[英]Initializing boost::shared_ptr<std::vector<T>> with boost::shared_ptr<std::list<T>>
[英]Elegant solution to converting a std::vector<boost::shared_ptr<T>> into a std::vector<T*>
我没有发现完全相同的问题。
有没有一种方法可以转换:
std::vector<boost::shared_ptr<T>>
转换为非安全版本:
std::vector<T*>
没有做for循环并在原始向量的每个元素上使用.get()?
std::transform(safe.begin(), safe.end(), std::back_inserter(unsafe),
boost::bind(&boost::shared_ptr<T>::get, _1));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.