Demonstrating the STL vector back and pop_back operations : vector back « vector « C++ Tutorial





#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
  string s("abcdefghij");

  vector<char> vector1(s.begin(), s.end());

  while (vector1.size() > 0) {
    cout << vector1.back();
    vector1.pop_back();
  }
  cout << endl;
  return 0;
}
jihgfedcba










16.4.vector back
16.4.1.Get the last element in the vector
16.4.2.Accessing the Back of a Vector
16.4.3.Demonstrating the STL vector back and pop_back operations