OLD | NEW |
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_TREE_H_ | 5 #ifndef BASE_CONTAINERS_FLAT_TREE_H_ |
6 #define BASE_CONTAINERS_FLAT_TREE_H_ | 6 #define BASE_CONTAINERS_FLAT_TREE_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 flat_tree(); | 75 flat_tree(); |
76 explicit flat_tree(const key_compare& comp); | 76 explicit flat_tree(const key_compare& comp); |
77 | 77 |
78 // Not stable in the presence of duplicates in the initializer list. | 78 // Not stable in the presence of duplicates in the initializer list. |
79 template <class InputIterator> | 79 template <class InputIterator> |
80 flat_tree(InputIterator first, | 80 flat_tree(InputIterator first, |
81 InputIterator last, | 81 InputIterator last, |
82 const key_compare& comp = key_compare()); | 82 const key_compare& comp = key_compare()); |
83 | 83 |
84 flat_tree(const flat_tree&); | 84 flat_tree(const flat_tree&); |
85 flat_tree(flat_tree&&); | 85 flat_tree(flat_tree&&) noexcept; |
86 | 86 |
87 // Not stable in the presence of duplicates in the initializer list. | 87 // Not stable in the presence of duplicates in the initializer list. |
88 flat_tree(std::initializer_list<value_type> ilist, | 88 flat_tree(std::initializer_list<value_type> ilist, |
89 const key_compare& comp = key_compare()); | 89 const key_compare& comp = key_compare()); |
90 | 90 |
91 ~flat_tree(); | 91 ~flat_tree(); |
92 | 92 |
93 // -------------------------------------------------------------------------- | 93 // -------------------------------------------------------------------------- |
94 // Assignments. | 94 // Assignments. |
95 // | 95 // |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 const KeyCompare& comp) | 328 const KeyCompare& comp) |
329 : impl_(comp, first, last) { | 329 : impl_(comp, first, last) { |
330 sort_and_unique(); | 330 sort_and_unique(); |
331 } | 331 } |
332 | 332 |
333 template <class Key, class Value, class GetKeyFromValue, class KeyCompare> | 333 template <class Key, class Value, class GetKeyFromValue, class KeyCompare> |
334 flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::flat_tree( | 334 flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::flat_tree( |
335 const flat_tree&) = default; | 335 const flat_tree&) = default; |
336 | 336 |
337 template <class Key, class Value, class GetKeyFromValue, class KeyCompare> | 337 template <class Key, class Value, class GetKeyFromValue, class KeyCompare> |
338 flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::flat_tree(flat_tree&&) = | 338 flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::flat_tree( |
339 default; | 339 flat_tree&&) noexcept = default; |
340 | 340 |
341 template <class Key, class Value, class GetKeyFromValue, class KeyCompare> | 341 template <class Key, class Value, class GetKeyFromValue, class KeyCompare> |
342 flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::flat_tree( | 342 flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::flat_tree( |
343 std::initializer_list<value_type> ilist, | 343 std::initializer_list<value_type> ilist, |
344 const KeyCompare& comp) | 344 const KeyCompare& comp) |
345 : flat_tree(std::begin(ilist), std::end(ilist), comp) {} | 345 : flat_tree(std::begin(ilist), std::end(ilist), comp) {} |
346 | 346 |
347 template <class Key, class Value, class GetKeyFromValue, class KeyCompare> | 347 template <class Key, class Value, class GetKeyFromValue, class KeyCompare> |
348 flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::~flat_tree() = default; | 348 flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::~flat_tree() = default; |
349 | 349 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 void EraseIf(base::internal::flat_tree<Key, Value, GetKeyFromValue, KeyCompare>& | 708 void EraseIf(base::internal::flat_tree<Key, Value, GetKeyFromValue, KeyCompare>& |
709 container, | 709 container, |
710 Predicate pred) { | 710 Predicate pred) { |
711 container.erase(std::remove_if(container.begin(), container.end(), pred), | 711 container.erase(std::remove_if(container.begin(), container.end(), pred), |
712 container.end()); | 712 container.end()); |
713 } | 713 } |
714 | 714 |
715 } // namespace base | 715 } // namespace base |
716 | 716 |
717 #endif // BASE_CONTAINERS_FLAT_TREE_H_ | 717 #endif // BASE_CONTAINERS_FLAT_TREE_H_ |
OLD | NEW |