Reputation: 27582
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.
The following works:
for (auto entity: *vec)
my question is there anyway to do the same without using the *
operator?
Upvotes: 5
Views: 2638
Reputation: 254431
No. The only sensible way to dereference a pointer is with the dereference operator.
Upvotes: 15