Check out example codes for "iterate const vector". It will help you in understanding the concepts better.

Code Example 1

void func(const std::vector<type>& vec) {
  std::vector<type>::const_iterator iter;
  for (iter = vec.begin(); iter != vec.end(); ++iter)
    // do something with *iter
}

Learn ReactJs, React Native from akashmittal.com