Demonstrating the STL vector push_back functions : vector push pop heap « vector « C++ Tutorial






#include <iostream>
#include <cassert>
#include <vector>
#include <string>
#include <algorithm>  // for reverse
using namespace std;


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

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

  vector<char> vector2;

  vector<char>::iterator i;

  for (i = vector1.begin(); i != vector1.end(); ++i)
    vector2.push_back(*i);

  for (i = vector2.begin(); i != vector2.end(); ++i)
    cout << *i;

  return 0;
}
qwer








16.20.vector push pop heap
16.20.1.Perform the heapsort with push_heap and pop_heap
16.20.2.Using pop_back to Erase the Last Element
16.20.3.pop_back from a vector
16.20.4.Demonstrating the STL vector push_back functions