| 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 <iterator> | 9 #include <iterator> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // | 117 // |
| 118 // The constructors that take ranges, lists, and vectors do not require that | 118 // The constructors that take ranges, lists, and vectors do not require that |
| 119 // the input be sorted. | 119 // the input be sorted. |
| 120 | 120 |
| 121 flat_tree(); | 121 flat_tree(); |
| 122 explicit flat_tree(const key_compare& comp); | 122 explicit flat_tree(const key_compare& comp); |
| 123 | 123 |
| 124 template <class InputIterator> | 124 template <class InputIterator> |
| 125 flat_tree(InputIterator first, | 125 flat_tree(InputIterator first, |
| 126 InputIterator last, | 126 InputIterator last, |
| 127 FlatContainerDupes dupe_handling, | 127 FlatContainerDupes dupe_handling = KEEP_FIRST_OF_DUPES, |
| 128 const key_compare& comp = key_compare()); | 128 const key_compare& comp = key_compare()); |
| 129 | 129 |
| 130 flat_tree(const flat_tree&); | 130 flat_tree(const flat_tree&); |
| 131 flat_tree(flat_tree&&); | 131 flat_tree(flat_tree&&); |
| 132 | 132 |
| 133 flat_tree(std::vector<value_type> items, | 133 flat_tree(std::vector<value_type> items, |
| 134 FlatContainerDupes dupe_handling, | 134 FlatContainerDupes dupe_handling = KEEP_FIRST_OF_DUPES, |
| 135 const key_compare& comp = key_compare()); | 135 const key_compare& comp = key_compare()); |
| 136 | 136 |
| 137 flat_tree(std::initializer_list<value_type> ilist, | 137 flat_tree(std::initializer_list<value_type> ilist, |
| 138 FlatContainerDupes dupe_handling, | 138 FlatContainerDupes dupe_handling = KEEP_FIRST_OF_DUPES, |
| 139 const key_compare& comp = key_compare()); | 139 const key_compare& comp = key_compare()); |
| 140 | 140 |
| 141 ~flat_tree(); | 141 ~flat_tree(); |
| 142 | 142 |
| 143 // -------------------------------------------------------------------------- | 143 // -------------------------------------------------------------------------- |
| 144 // Assignments. | 144 // Assignments. |
| 145 // | 145 // |
| 146 // Assume that move assignment invalidates iterators and references. | 146 // Assume that move assignment invalidates iterators and references. |
| 147 | 147 |
| 148 flat_tree& operator=(const flat_tree&); | 148 flat_tree& operator=(const flat_tree&); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 iterator insert(const_iterator position_hint, const value_type& x); | 209 iterator insert(const_iterator position_hint, const value_type& x); |
| 210 iterator insert(const_iterator position_hint, value_type&& x); | 210 iterator insert(const_iterator position_hint, value_type&& x); |
| 211 | 211 |
| 212 // This method inserts the values from the range [first, last) into the | 212 // This method inserts the values from the range [first, last) into the |
| 213 // current tree. In case of KEEP_LAST_OF_DUPES newly added elements can | 213 // current tree. In case of KEEP_LAST_OF_DUPES newly added elements can |
| 214 // overwrite existing values. | 214 // overwrite existing values. |
| 215 template <class InputIterator> | 215 template <class InputIterator> |
| 216 void insert(InputIterator first, | 216 void insert(InputIterator first, |
| 217 InputIterator last, | 217 InputIterator last, |
| 218 FlatContainerDupes dupes); | 218 FlatContainerDupes dupes = KEEP_FIRST_OF_DUPES); |
| 219 | 219 |
| 220 template <class... Args> | 220 template <class... Args> |
| 221 std::pair<iterator, bool> emplace(Args&&... args); | 221 std::pair<iterator, bool> emplace(Args&&... args); |
| 222 | 222 |
| 223 template <class... Args> | 223 template <class... Args> |
| 224 iterator emplace_hint(const_iterator position_hint, Args&&... args); | 224 iterator emplace_hint(const_iterator position_hint, Args&&... args); |
| 225 | 225 |
| 226 // -------------------------------------------------------------------------- | 226 // -------------------------------------------------------------------------- |
| 227 // Erase operations. | 227 // Erase operations. |
| 228 // | 228 // |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 void EraseIf(base::internal::flat_tree<Key, Value, GetKeyFromValue, KeyCompare>& | 913 void EraseIf(base::internal::flat_tree<Key, Value, GetKeyFromValue, KeyCompare>& |
| 914 container, | 914 container, |
| 915 Predicate pred) { | 915 Predicate pred) { |
| 916 container.erase(std::remove_if(container.begin(), container.end(), pred), | 916 container.erase(std::remove_if(container.begin(), container.end(), pred), |
| 917 container.end()); | 917 container.end()); |
| 918 } | 918 } |
| 919 | 919 |
| 920 } // namespace base | 920 } // namespace base |
| 921 | 921 |
| 922 #endif // BASE_CONTAINERS_FLAT_TREE_H_ | 922 #endif // BASE_CONTAINERS_FLAT_TREE_H_ |
| OLD | NEW |