Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // uniquevector
- //
- // Created by Rizky Herucakra on 7/4/13.
- // Copyright (c) 2013 Rizky Herucakra. All rights reserved.
- //
- #include <vector>
- #include <algorithm>
- #include <iostream>
- using namespace std;
- struct Point
- {
- int x ;
- int y;
- };
- bool point_eq(const Point& a, const Point& b){
- return (a.x == b.x) && (a.y == b.y);
- }
- int main()
- {
- vector< Point> myPoints = {{2,4},{2,4},{5,4},{0,1}};
- myPoints.erase( unique(myPoints.begin(),myPoints.end(), point_eq) );
- for (auto& t : myPoints){
- cout << "{ " << t.x << " , " << t.y << " }" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement