Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: base/containers/flat_map.h

Issue 2783823002: Fix compilation issue with base::flat_map. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_CONTAINERS_FLAT_MAP_H_ 5 #ifndef BASE_CONTAINERS_FLAT_MAP_H_
6 #define BASE_CONTAINERS_FLAT_MAP_H_ 6 #define BASE_CONTAINERS_FLAT_MAP_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/containers/flat_tree.h" 10 #include "base/containers/flat_tree.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 return *this; 233 return *this;
234 } 234 }
235 235
236 // ---------------------------------------------------------------------------- 236 // ----------------------------------------------------------------------------
237 // Insert operations. 237 // Insert operations.
238 238
239 template <class Key, class Mapped, class Compare> 239 template <class Key, class Mapped, class Compare>
240 auto flat_map<Key, Mapped, Compare>::operator[](const Key& key) -> Mapped& { 240 auto flat_map<Key, Mapped, Compare>::operator[](const Key& key) -> Mapped& {
241 typename tree::iterator found = tree::lower_bound(key); 241 typename tree::iterator found = tree::lower_bound(key);
242 if (found == tree::end() || tree::key_comp()(key, found->first)) 242 if (found == tree::end() || tree::key_comp()(key, found->first))
243 found = unsafe_emplace(found, key, Mapped()); 243 found = tree::unsafe_emplace(found, key, Mapped());
244 return found->second; 244 return found->second;
245 } 245 }
246 246
247 template <class Key, class Mapped, class Compare> 247 template <class Key, class Mapped, class Compare>
248 auto flat_map<Key, Mapped, Compare>::operator[](Key&& key) -> Mapped& { 248 auto flat_map<Key, Mapped, Compare>::operator[](Key&& key) -> Mapped& {
249 const Key& key_ref = key; 249 const Key& key_ref = key;
250 typename tree::iterator found = tree::lower_bound(key_ref); 250 typename tree::iterator found = tree::lower_bound(key_ref);
251 if (found == tree::end() || tree::key_comp()(key, found->first)) 251 if (found == tree::end() || tree::key_comp()(key, found->first))
252 found = tree::unsafe_emplace(found, std::move(key), Mapped()); 252 found = tree::unsafe_emplace(found, std::move(key), Mapped());
253 return found->second; 253 return found->second;
254 } 254 }
255 255
256 // ---------------------------------------------------------------------------- 256 // ----------------------------------------------------------------------------
257 // General operations. 257 // General operations.
258 258
259 template <class Key, class Mapped, class Compare> 259 template <class Key, class Mapped, class Compare>
260 void flat_map<Key, Mapped, Compare>::swap(flat_map& other) { 260 void flat_map<Key, Mapped, Compare>::swap(flat_map& other) {
261 tree::swap(other); 261 tree::swap(other);
262 } 262 }
263 263
264 } // namespace base 264 } // namespace base
265 265
266 #endif // BASE_CONTAINERS_FLAT_MAP_H_ 266 #endif // BASE_CONTAINERS_FLAT_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698