File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,24 @@ namespace std {
20
20
tuple<Args...> tie (Args&... args) {
21
21
return tuple<Args...>(args...);
22
22
}
23
+
24
+ template <typename Key, typename Value>
25
+ class unordered_map {
26
+ public:
27
+ using value_type = pair<Key, Value>;
28
+
29
+ class iterator {
30
+ public:
31
+ iterator& operator ++();
32
+ bool operator !=(const iterator &other);
33
+ const value_type &operator *() const ;
34
+ value_type operator *();
35
+ const value_type* operator ->() const ;
36
+ };
37
+
38
+ iterator begin () const ;
39
+ iterator end () const ;
40
+ };
23
41
}
24
42
25
43
template <typename T1, typename T2>
Original file line number Diff line number Diff line change @@ -651,3 +651,15 @@ void IgnoreDirectInit() {
651
651
int y = P.second ;
652
652
}
653
653
}
654
+
655
+ void StdMapTestCases () {
656
+ for (auto p : std::unordered_map<int , int >()) {
657
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
658
+ // CHECK-FIXES: for (auto [x, y] : std::unordered_map<int, int>()) {
659
+ // CHECK-NEXT: // REMOVE
660
+ int x = p.first ;
661
+ int y = p.second ; // REMOVE
662
+ // CHECK-FIXES: // REMOVE
663
+ }
664
+ }
665
+
You can’t perform that action at this time.
0 commit comments