language: C++11 (gcc-4.7.2)
date: 727 days 9 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
 
using std::cout;
using std::endl;
#include <iterator>
#include <vector>
#include <algorithm>
 
int main()
{
 
        const int SIZE = 10;
        int a[SIZE] = {10, 2, 35, 5, 10, 26, 67, 2, 5, 10};
        std::ostream_iterator< int > output(cout, " ");
        std::vector< int > v(a, a + SIZE);
        std::vector< int >::iterator newLastElement;
 
        cout << "contents of the vector: ";
        std::copy(v.begin(), v.end(), output);
 
        newLastElement = std::remove(v.begin(), v.end(), 10);
        cout << "\ncontents of the vector after remove: ";
        //std::copy(v.begin(), newLastElement, output);
        std::copy(v.begin(), v.end(), output);
 
        cout << endl;
        return 0;
}