#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<char> vectorObject;
vector<char>::iterator p, p_end;
int i;
for(i = 0; i <5; i++) {
vectorObject.push_back('A'+i);
vectorObject.push_back('A'+i);
vectorObject.push_back('A'+i);
}
cout << "Original contents of vectorObject:\n";
for(p = vectorObject.begin(); p < vectorObject.end(); p++)
cout << *p << " ";
cout << endl;
p_end = unique(vectorObject.begin(), vectorObject.end()); // remove duplicates
cout << "Sequence after removing duplicates:\n";
for(p = vectorObject.begin(); p < p_end; p++)
cout << *p << " ";
cout << endl;
return 0;
}
|