aboutsummaryrefslogtreecommitdiff
path: root/src/util/algorithm.hpp
blob: 60c68e2d0da16ed9c1078451f8fb539d558b2867 (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
32
33
34
35
36
37
38
#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 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;

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_impl.hpp"