aboutsummaryrefslogtreecommitdiff
path: root/src/util/algorithm_impl.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/algorithm_impl.hpp')
-rw-r--r--src/util/algorithm_impl.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/algorithm_impl.hpp b/src/util/algorithm_impl.hpp
index 00269ed..d7c5e3b 100644
--- a/src/util/algorithm_impl.hpp
+++ b/src/util/algorithm_impl.hpp
@@ -12,6 +12,16 @@ constexpr auto container_find(const ContainerType &container, const Value &value
return std::find(container.begin(), container.end(), value);
}
+template <typename ContainerType, typename Predicate>
+requires Container<ContainerType> &&
+ std::predicate<Predicate, typename ContainerType::value_type>
+constexpr auto
+container_find(const ContainerType &container, Predicate predicate) noexcept ->
+ typename ContainerType::const_iterator
+{
+ return std::find_if(container.begin(), container.end(), predicate);
+}
+
template <typename ContainerType, typename Value>
requires Container<ContainerType>
constexpr auto container_has(const ContainerType &container, const Value &value) noexcept