CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
FindIfNot.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "FindIf.hpp"
11#include "UnaryAlgorithm.hpp"
12
14
15#include <variant>
16
17namespace CeresEngine {
18
21 class FindIfNotAlgorithmFunctor : public UnaryAlgorithmFunctor<FindIfNotAlgorithmFunctor> {
23
32 template<class I, class S, class Fun>
33 requires(
34 // clang-format off
35 traits::is_input_iterator_v<I> &&
36 traits::is_sentinel_for_v<S, I> &&
37 traits::is_indirectly_unary_invocable_v<Fun, I> &&
38 std::is_copy_constructible_v<Fun>
39 // clang-format on
40 ) static constexpr I run(I first, S last, Fun p) {
41 return std::find_if_not(first, last, std::move(p));
42 }
43
56 template<class E, class P, class I, class S, class Fun>
57 requires(
58 // clang-format off
59 traits::is_executor_v<E> &&
60 traits::is_partitioner_v<P, I, S> &&
61 traits::is_input_iterator_v<I> &&
62 traits::is_sentinel_for_v<S, I> &&
63 traits::is_indirectly_unary_invocable_v<Fun, I> &&
64 std::is_copy_constructible_v<Fun>
65 // clang-format on
66 ) static Async<I> run(const E& executor, P p, I first, S last, Fun f) {
67 return FindIfAlgorithmFunctor{}.run(executor, p, first, last, std::move(f));
68 }
69 };
70
73
74} // namespace CeresEngine
A partitioner is a light callable object that takes a pair of iterators and returns the middle of the...
Identify traits for algorithms, like we do for other types The traits help us generate auxiliary algo...
Functor representing the overloads for the find_if function.
Definition FindIf.hpp:21
static constexpr I run(I first, S last, Fun p)
Complete overload of the find_if algorithm.
Definition FindIf.hpp:81
Functor representing the overloads for the find_if_not function.
Definition FindIfNot.hpp:21
static Async< I > run(const E &executor, P p, I first, S last, Fun f)
Complete overload of the find_if_not algorithm.
Definition FindIfNot.hpp:66
static constexpr I run(I first, S last, Fun p)
Complete overload of the find_if_not algorithm.
Definition FindIfNot.hpp:40
Overloads for unary invoke algorithms.
Definition UnaryAlgorithm.hpp:34
Definition Application.hpp:19
cti::continuable< Args... > Async
Defines a non-copyable continuation type which uses the function2 backend for type erasure.
Definition Async.hpp:22
constexpr FindIfNotAlgorithmFunctor find_if_not
Finds the first element not satisfying specific criteria.
Definition FindIfNot.hpp:72
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25