Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <iterator>
- #include <deque>
- using namespace std;
- template <typename T>
- void print(const T& coll)
- {
- copy(coll.cbegin(), coll.cend(),
- ostream_iterator<typename T::value_type>(cout, " "));
- cout << endl;
- }
- int main()
- {
- deque<int> coll{ 1, 2, 2, 1, 1, 1, 5, 5, 0, 0, 0, 0,3,3,3,3,3 };
- print(coll);
- size_t sz = coll.size();
- coll.erase(unique(coll.begin(), coll.end()), coll.end());
- print(coll);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment