diff options
Diffstat (limited to 'chromium/base/stl_util.h')
-rw-r--r-- | chromium/base/stl_util.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/chromium/base/stl_util.h b/chromium/base/stl_util.h index 8269b0b38ec..d8db9b141b8 100644 --- a/chromium/base/stl_util.h +++ b/chromium/base/stl_util.h @@ -23,7 +23,7 @@ #include <utility> #include <vector> -#include "base/logging.h" +#include "base/check.h" #include "base/optional.h" #include "base/template_util.h" @@ -561,14 +561,6 @@ size_t EraseIf(std::vector<T, Allocator>& container, Predicate pred) { return removed; } -template <class T, class Allocator, class Value> -size_t Erase(std::forward_list<T, Allocator>& container, const Value& value) { - // Unlike std::forward_list::remove, this function template accepts - // heterogeneous types and does not force a conversion to the container's - // value type before invoking the == operator. - return EraseIf(container, [&](const T& cur) { return cur == value; }); -} - template <class T, class Allocator, class Predicate> size_t EraseIf(std::forward_list<T, Allocator>& container, Predicate pred) { // Note: std::forward_list does not have a size() API, thus we need to use the @@ -579,14 +571,6 @@ size_t EraseIf(std::forward_list<T, Allocator>& container, Predicate pred) { return old_size - std::distance(container.begin(), container.end()); } -template <class T, class Allocator, class Value> -size_t Erase(std::list<T, Allocator>& container, const Value& value) { - // Unlike std::list::remove, this function template accepts heterogeneous - // types and does not force a conversion to the container's value type before - // invoking the == operator. - return EraseIf(container, [&](const T& cur) { return cur == value; }); -} - template <class T, class Allocator, class Predicate> size_t EraseIf(std::list<T, Allocator>& container, Predicate pred) { size_t old_size = container.size(); @@ -661,6 +645,22 @@ size_t EraseIf( return internal::IterateAndEraseIf(container, pred); } +template <class T, class Allocator, class Value> +size_t Erase(std::forward_list<T, Allocator>& container, const Value& value) { + // Unlike std::forward_list::remove, this function template accepts + // heterogeneous types and does not force a conversion to the container's + // value type before invoking the == operator. + return EraseIf(container, [&](const T& cur) { return cur == value; }); +} + +template <class T, class Allocator, class Value> +size_t Erase(std::list<T, Allocator>& container, const Value& value) { + // Unlike std::list::remove, this function template accepts heterogeneous + // types and does not force a conversion to the container's value type before + // invoking the == operator. + return EraseIf(container, [&](const T& cur) { return cur == value; }); +} + // A helper class to be used as the predicate with |EraseIf| to implement // in-place set intersection. Helps implement the algorithm of going through // each container an element at a time, erasing elements from the first |