diff options
Diffstat (limited to 'src/util/algorithm.hpp')
-rw-r--r-- | src/util/algorithm.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/util/algorithm.hpp b/src/util/algorithm.hpp new file mode 100644 index 0000000..71a1724 --- /dev/null +++ b/src/util/algorithm.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include "util/concepts.hpp" + +#include <concepts> + +template <typename ContainerType, typename Value> +requires Container<ContainerType> +constexpr auto container_find(const ContainerType &container, const Value &value) noexcept + -> typename ContainerType::const_iterator; + +template <typename ContainerType, typename Value> +requires Container<ContainerType> +constexpr auto container_has(const ContainerType &container, const Value &value) noexcept + -> bool; + +template <typename ContainerType, typename Predicate> +requires Container<ContainerType> && HasPushBack<ContainerType> && + std::predicate<Predicate, typename ContainerType::value_type> +constexpr auto +container_filter(const ContainerType &container, Predicate predicate) noexcept + -> ContainerType; + +template <typename ContainerType, typename Predicate> +requires Container<ContainerType> && + std::predicate<Predicate, typename ContainerType::value_type> +constexpr auto +container_filter(const ContainerType &container, Predicate predicate) noexcept + -> ContainerType; + +#include "algorithm.tpp" |