aboutsummaryrefslogtreecommitdiff
path: root/src/util/algorithm.hpp
blob: 71a1724fc54d467626cbc0dac243e8aa11ba0445 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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"