// Using the STL generic reverse algorithm with a vector.
#include <iostream>
#include <algorithm>
#include <vector>
#include <assert.h>
using namespace std;

vector<char> vec(char* s)
  // Return vector<char> containing the characters of s
  // (not including the terminating null).
{
  vector<char> x;
  while (*s != '\0')
    x.push_back(*s++);
  return x;
}

int main()
{
  cout << "Using reverse algorithm with a vector" << endl;
  vector<char> vector1 = vec("mark twain");
  reverse(vector1.begin(), vector1.end());
  assert(vector1 == vec("niawt kram"));
  return 0;
}
