![](/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.