| OLD | NEW |
| 1 // | 1 // |
| 2 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 // 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 | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 // | 5 // |
| 6 // STL utility functions. Usually, these replace built-in, but slow(!), | 6 // STL utility functions. Usually, these replace built-in, but slow(!), |
| 7 // STL functions with more efficient versions. | 7 // STL functions with more efficient versions. |
| 8 // | 8 // |
| 9 | 9 |
| 10 #ifndef CHROME_COMMON_STL_UTIL_INL_H__ | 10 #ifndef CHROME_COMMON_STL_UTIL_INL_H__ |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 template<typename Pair, typename BinaryOp> | 434 template<typename Pair, typename BinaryOp> |
| 435 BinaryOperateOnSecond<Pair, BinaryOp> BinaryOperate2nd(const BinaryOp& f) { | 435 BinaryOperateOnSecond<Pair, BinaryOp> BinaryOperate2nd(const BinaryOp& f) { |
| 436 return BinaryOperateOnSecond<Pair, BinaryOp>(f); | 436 return BinaryOperateOnSecond<Pair, BinaryOp>(f); |
| 437 } | 437 } |
| 438 | 438 |
| 439 // Translates a set into a vector. | 439 // Translates a set into a vector. |
| 440 template<typename T> | 440 template<typename T> |
| 441 std::vector<T> SetToVector(const std::set<T>& values) { | 441 std::vector<T> SetToVector(const std::set<T>& values) { |
| 442 std::vector<T> result; | 442 std::vector<T> result; |
| 443 result.reserve(values.size()); | 443 result.reserve(values.size()); |
| 444 std::set<T>::const_iterator end = values.end(); | 444 result.insert(0, values.begin(), value.end()); |
| 445 for (std::set<T>::const_iterator itr = values.begin(); itr != end; ++itr) { | |
| 446 result.push_back(*itr); | |
| 447 } | |
| 448 return result; | 445 return result; |
| 449 } | 446 } |
| 450 | 447 |
| 451 #endif // CHROME_COMMON_STL_UTIL_INL_H__ | 448 #endif // CHROME_COMMON_STL_UTIL_INL_H__ |
| 452 | |
| OLD | NEW |