16.3.9. inplace_merge, unique_copy and reverse_copy

Figure 16.9 demonstrates algorithms inplace_merge, unique_copy and reverse_copy.

 1   // Fig. 16.9: fig16_09.cpp 2   // Algorithms inplace_merge, reverse_copy and unique_copy. 3   #include <iostream> 4   #include <algorithm> // algorithm definitions 5   #include <array> // array class-template definition 6   #include <vector> // vector class-template definition 7   #include <iterator> // back_inserter definition 8   using namespace std; 9 10   int main()11   {12      const int SIZE = 10;13      array< int, SIZE > a1 = { 1, 3, 5, 7, 9, 1, 3, 5, 7, 9 };14      ostream_iterator< int > output( cout, " " );15 16      cout << "array a1 contains: ";17      copy( a1.cbegin(), ...

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.