| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CC_BASE_SCOPED_PTR_VECTOR_H_ | 5 #ifndef CC_BASE_SCOPED_PTR_VECTOR_H_ |
| 6 #define CC_BASE_SCOPED_PTR_VECTOR_H_ | 6 #define CC_BASE_SCOPED_PTR_VECTOR_H_ |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 typename std::vector<T*>::iterator writable_a = a; | 159 typename std::vector<T*>::iterator writable_a = a; |
| 160 typename std::vector<T*>::iterator writable_b = b; | 160 typename std::vector<T*>::iterator writable_b = b; |
| 161 std::swap(*writable_a, *writable_b); | 161 std::swap(*writable_a, *writable_b); |
| 162 } | 162 } |
| 163 | 163 |
| 164 template<class Compare> | 164 template<class Compare> |
| 165 inline void sort(Compare comp) { | 165 inline void sort(Compare comp) { |
| 166 std::sort(data_.begin(), data_.end(), comp); | 166 std::sort(data_.begin(), data_.end(), comp); |
| 167 } | 167 } |
| 168 | 168 |
| 169 template <class Compare> |
| 170 inline void make_heap(Compare comp) { |
| 171 std::make_heap(data_.begin(), data_.end(), comp); |
| 172 } |
| 173 |
| 174 template <class Compare> |
| 175 inline void push_heap(Compare comp) { |
| 176 std::push_heap(data_.begin(), data_.end(), comp); |
| 177 } |
| 178 |
| 179 template <class Compare> |
| 180 inline void pop_heap(Compare comp) { |
| 181 std::pop_heap(data_.begin(), data_.end(), comp); |
| 182 } |
| 183 |
| 169 iterator begin() { return static_cast<iterator>(data_.begin()); } | 184 iterator begin() { return static_cast<iterator>(data_.begin()); } |
| 170 const_iterator begin() const { return data_.begin(); } | 185 const_iterator begin() const { return data_.begin(); } |
| 171 iterator end() { return static_cast<iterator>(data_.end()); } | 186 iterator end() { return static_cast<iterator>(data_.end()); } |
| 172 const_iterator end() const { return data_.end(); } | 187 const_iterator end() const { return data_.end(); } |
| 173 | 188 |
| 174 reverse_iterator rbegin() { return data_.rbegin(); } | 189 reverse_iterator rbegin() { return data_.rbegin(); } |
| 175 const_reverse_iterator rbegin() const { return data_.rbegin(); } | 190 const_reverse_iterator rbegin() const { return data_.rbegin(); } |
| 176 reverse_iterator rend() { return data_.rend(); } | 191 reverse_iterator rend() { return data_.rend(); } |
| 177 const_reverse_iterator rend() const { return data_.rend(); } | 192 const_reverse_iterator rend() const { return data_.rend(); } |
| 178 | 193 |
| 179 private: | 194 private: |
| 180 std::vector<T*> data_; | 195 std::vector<T*> data_; |
| 181 | 196 |
| 182 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector); | 197 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector); |
| 183 }; | 198 }; |
| 184 | 199 |
| 185 } // namespace cc | 200 } // namespace cc |
| 186 | 201 |
| 187 #endif // CC_BASE_SCOPED_PTR_VECTOR_H_ | 202 #endif // CC_BASE_SCOPED_PTR_VECTOR_H_ |
| OLD | NEW |