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 {
2020 tuple<Args...> tie (Args&... args) {
2121 return tuple<Args...>(args...);
2222 }
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+ };
2341}
2442
2543template <typename T1, typename T2>
Original file line number Diff line number Diff line change @@ -651,3 +651,15 @@ void IgnoreDirectInit() {
651651 int y = P.second ;
652652 }
653653}
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