diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/base/stl_util.h | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
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 |