Check out example codes for "c++ how to skip the last element of vector". It will help you in understanding the concepts better.

Code Example 1

std::vector<int> x{1,2,3,4,5,6};

for (auto iter = x.begin(); iter != std::prev(x.end()); ++iter){
  std::cout << *iter << std::endl;
}

Learn ReactJs, React Native from akashmittal.com