[英]Elegant solution to converting a std::vector<boost::shared_ptr<T>> into a std::vector<T*>
I did not find exactly the same question. 我没有发现完全相同的问题。
Is there a way to convert a: 有没有一种方法可以转换:
std::vector<boost::shared_ptr<T>>
into a non safe version: 转换为非安全版本:
std::vector<T*>
without doing a for loop and using .get() on each element of the original vector ? 没有做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.