File tree Expand file tree Collapse file tree 4 files changed +31
-14
lines changed
Expand file tree Collapse file tree 4 files changed +31
-14
lines changed Original file line number Diff line number Diff line change @@ -42,9 +42,9 @@ struct convert<std::unordered_map<K, V>> {
4242 for (; p != pend; ++p) {
4343 K key;
4444 p->key .convert (key);
45- p->val .convert (tmp[key]);
45+ p->val .convert (tmp[std::move ( key) ]);
4646 }
47- tmp. swap (v );
47+ v = std::move (tmp );
4848 return o;
4949 }
5050};
@@ -100,9 +100,9 @@ struct convert<std::unordered_multimap<K, V>> {
100100 std::pair<K, V> value;
101101 p->key .convert (value.first );
102102 p->val .convert (value.second );
103- tmp.insert (value);
103+ tmp.insert (std::move ( value) );
104104 }
105- tmp. swap (v );
105+ v = std::move (tmp );
106106 return o;
107107 }
108108};
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ struct convert<std::unordered_set<T>> {
4343 --p;
4444 tmp.insert (p->as <T>());
4545 }
46- tmp. swap (v );
46+ v = std::move (tmp );
4747 return o;
4848 }
4949};
@@ -97,7 +97,7 @@ struct convert<std::unordered_multiset<T>> {
9797 --p;
9898 tmp.insert (p->as <T>());
9999 }
100- tmp. swap (v );
100+ v = std::move (tmp );
101101 return o;
102102 }
103103};
Original file line number Diff line number Diff line change @@ -115,16 +115,17 @@ struct convert<std::map<K, V> > {
115115 for (; p != pend; ++p) {
116116 K key;
117117 p->key .convert (key);
118- typename std::map<K,V>::iterator it (tmp.lower_bound (key));
119- if (it != tmp.end () && !(key < it->first )) {
120- p->val .convert (it->second );
121- } else {
122- V val;
123- p->val .convert (val);
124- tmp.insert (it, std::pair<K,V>(key, val));
125- }
118+ #if __cplusplus >= 201103L
119+ p->val .convert (tmp[std::move (key)]);
120+ #else
121+ p->val .convert (tmp[key]);
122+ #endif
126123 }
124+ #if __cplusplus >= 201103L
125+ v = std::move (tmp);
126+ #else
127127 tmp.swap (v);
128+ #endif
128129 return o;
129130 }
130131};
@@ -180,9 +181,17 @@ struct convert<std::multimap<K, V> > {
180181 std::pair<K, V> value;
181182 p->key .convert (value.first );
182183 p->val .convert (value.second );
184+ #if __cplusplus >= 201103L
185+ tmp.insert (std::move (value));
186+ #else
183187 tmp.insert (value);
188+ #endif
184189 }
190+ #if __cplusplus >= 201103L
191+ v = std::move (tmp);
192+ #else
185193 tmp.swap (v);
194+ #endif
186195 return o;
187196 }
188197};
Original file line number Diff line number Diff line change @@ -43,7 +43,11 @@ struct convert<std::set<T> > {
4343 --p;
4444 tmp.insert (p->as <T>());
4545 }
46+ #if __cplusplus >= 201103L
47+ v = std::move (tmp);
48+ #else
4649 tmp.swap (v);
50+ #endif
4751 return o;
4852 }
4953};
@@ -96,7 +100,11 @@ struct convert<std::multiset<T> > {
96100 --p;
97101 tmp.insert (p->as <T>());
98102 }
103+ #if __cplusplus >= 201103L
104+ v = std::move (tmp);
105+ #else
99106 tmp.swap (v);
107+ #endif
100108 return o;
101109 }
102110};
You can’t perform that action at this time.
0 commit comments