I am very new to C++ and I try to understand a large project. Here's where I'm stuck,I want to index container class without for-each.
There's this method returns pointer of a container class Bars:
virtual Bars* getBarsPtr() { return &bars_; }
In the code, each element are accessed by for-each, and it works. Bar is the element of for-each. The code is in the following:
for (auto& bar : *foo_.getBarsPtr()) {
getBarsPtr() returns the pointer to Bars. The thing I am wondering, how can I access each 'bar' without for-each.
UPDATE: As SergeyA answered, this container did not provide indexed access. Regards