OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Derived from google3/util/gtl/stl_util.h | 5 // Derived from google3/util/gtl/stl_util.h |
6 | 6 |
7 #ifndef BASE_STL_UTIL_H_ | 7 #ifndef BASE_STL_UTIL_H_ |
8 #define BASE_STL_UTIL_H_ | 8 #define BASE_STL_UTIL_H_ |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <functional> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 | 16 |
16 // Clears internal memory of an STL object. | 17 // Clears internal memory of an STL object. |
17 // STL clear()/reserve(0) does not always free internal memory allocated | 18 // STL clear()/reserve(0) does not always free internal memory allocated |
18 // This function uses swap/destructor to ensure the internal memory is freed. | 19 // This function uses swap/destructor to ensure the internal memory is freed. |
19 template<class T> | 20 template<class T> |
20 void STLClearObject(T* obj) { | 21 void STLClearObject(T* obj) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 ResultType difference; | 213 ResultType difference; |
213 std::set_difference(a1.begin(), a1.end(), | 214 std::set_difference(a1.begin(), a1.end(), |
214 a2.begin(), a2.end(), | 215 a2.begin(), a2.end(), |
215 std::inserter(difference, difference.end())); | 216 std::inserter(difference, difference.end())); |
216 return difference; | 217 return difference; |
217 } | 218 } |
218 | 219 |
219 } // namespace base | 220 } // namespace base |
220 | 221 |
221 #endif // BASE_STL_UTIL_H_ | 222 #endif // BASE_STL_UTIL_H_ |
OLD | NEW |