| OLD | NEW |
| 1 // | |
| 2 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 3 // 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 |
| 4 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 5 // | 4 |
| 6 // STL utility functions. Usually, these replace built-in, but slow(!), | 5 // STL utility functions. Usually, these replace built-in, but slow(!), |
| 7 // STL functions with more efficient versions. | 6 // STL functions with more efficient versions. |
| 8 // | |
| 9 | 7 |
| 10 #ifndef CHROME_COMMON_STL_UTIL_INL_H__ | 8 #ifndef BASE_STL_UTIL_INL_H_ |
| 11 #define CHROME_COMMON_STL_UTIL_INL_H__ | 9 #define BASE_STL_UTIL_INL_H_ |
| 12 | 10 |
| 13 #include <string.h> // for memcpy | 11 #include <string.h> // for memcpy |
| 14 #include <functional> | 12 #include <functional> |
| 15 #include <set> | 13 #include <set> |
| 16 #include <string> | 14 #include <string> |
| 17 #include <vector> | 15 #include <vector> |
| 18 #include <cassert> | 16 #include <cassert> |
| 19 | 17 |
| 20 // Clear internal memory of an STL object. | 18 // Clear internal memory of an STL object. |
| 21 // STL clear()/reserve(0) does not always free internal memory allocated | 19 // STL clear()/reserve(0) does not always free internal memory allocated |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 440 |
| 443 // Translates a set into a vector. | 441 // Translates a set into a vector. |
| 444 template<typename T> | 442 template<typename T> |
| 445 std::vector<T> SetToVector(const std::set<T>& values) { | 443 std::vector<T> SetToVector(const std::set<T>& values) { |
| 446 std::vector<T> result; | 444 std::vector<T> result; |
| 447 result.reserve(values.size()); | 445 result.reserve(values.size()); |
| 448 result.insert(result.begin(), values.begin(), values.end()); | 446 result.insert(result.begin(), values.begin(), values.end()); |
| 449 return result; | 447 return result; |
| 450 } | 448 } |
| 451 | 449 |
| 452 #endif // CHROME_COMMON_STL_UTIL_INL_H__ | 450 #endif // BASE_STL_UTIL_INL_H_ |
| OLD | NEW |