diff options
author | HampusM <hampus@hampusmat.com> | 2022-06-02 19:51:54 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:57:00 +0200 |
commit | eecf4b1e666211a13afa56f93477c55e8fd01621 (patch) | |
tree | 410510d6e058995174d5a5b0f535fb457a0c3542 /src/util/algorithm.hpp | |
parent | 87f55120f96d0f4f80b497dc9006d89df2dda125 (diff) |
feat: implement game of lifev0.1.0
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" |