aboutsummaryrefslogtreecommitdiff
path: root/src/util/algorithm_impl.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-06-12 13:44:58 +0200
committerHampusM <hampus@hampusmat.com>2022-06-13 17:57:01 +0200
commit927e065f9829045247be7c0b3296408b6f577c1f (patch)
tree7da3d9cd5aa4070414a8708a582f6c3ab3e1e708 /src/util/algorithm_impl.hpp
parenteb66598c326862fd9dfc1899be4eac93f81a8023 (diff)
feat: add reading RLE files
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