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?
No. The only sensible way to dereference a pointer is with the dereference operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With