#include <algorithm> #include <iostream> #include <set> using namespace std; struct cmp { bool operator()(const pair<int, int> &lhs, const pair<int, int> &rhs) { return lhs.first < lhs.first || (lhs.first == rhs.first && lhs.second < rhs.second); } }; int main () { set<pair<int, int>, cmp> test1; set<pair<int, int>> test2; test1.insert({2, 99}); test1.insert({5, 100}); test1.insert({100, 100}); cout << "test1 elements: \n"; for (auto e : test1) cout << e.first << " " << e.second << "\n"; test2.insert({2, 99}); test2.insert({5, 100}); test2.insert({100, 100}); cout << "test2 elements: \n"; for (auto e : test2) cout << e.first << " " << e.second << "\n"; return 0; } | cs |
test1이 test2랑 똑같이 나와야 되는거 아님???
multiset으로도 테스트 해봤는데, 왜 key값이 같은거처럼 동작하는거지??
님 11번 줄 다시 봐
아ㅓㅏㅓㅏ.... ㄳ...
이거 때매 시간 개잡아먹었는데 ㅁㅊ. ...
그래서 뭐가 잘못됐던거야 나도 알려줘
lhs.front < lhs.front 능지... 박살...