[英]Iterate shared_ptr<std::vector<T>>
Let's assume I have the following: 我们假设我有以下内容:
auto vec = std::shared_ptr<std::vector<T>>
And I want to loop through all the vec
entities using C++11
Range-Based for Loop. 我想使用
C++11
Range-Based for Loop遍历所有vec
实体。
The following works: 以下作品:
for (auto entity: *vec)
my question is there anyway to do the same without using the *
operator? 我的问题是在没有使用
*
运算符的情况下做同样的事情?
否。取消引用指针的唯一合理方法是使用解引用运算符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.