1#ifndef ADIAR_FUNCTIONAL_H
2#define ADIAR_FUNCTIONAL_H
7#include <adiar/exception.h>
8#include <adiar/types.h>
37 template <
typename TypeSignature>
47 template <
typename...
Args>
59 template <
typename Arg>
65 template <
typename ValueType,
typename OutputIt>
75 template <
typename ValueType,
typename OutputIt>
85 template <
typename OutputIt>
89 using value_type =
typename OutputIt::container_type::value_type;
97 template <
typename OutputIt>
101 using value_type =
typename OutputIt::container_type::value_type;
113 template <
typename ForwardIt>
117 using value_type =
typename ForwardIt::value_type;
121 throw out_of_range(
"Iterator range unable to contain all generated values");
134 template <
typename ForwardIt>
138 using value_type =
typename ForwardIt::value_type;
142 throw out_of_range(
"Iterator range unable to contain all generated values");
154 template <
typename VarType>
168 template <
typename RetType>
174 template <
typename ForwardIt>
178 using value_type =
typename ForwardIt::value_type;
189 template <
typename ForwardIt>
193 using value_type =
typename ForwardIt::value_type;
204 template <
typename Stream>
208 using value_type =
typename Stream::value_type;
211 if (!
s.can_pull()) {
return {}; }
219 template <
typename RetType>
224 if (
_end) {
return {}; }
function< optional< RetType >()> generator
Generator function that produces a new value of RetType for each call.
Definition functional.h:169
function< double(VarType)> cost
Cost function that assigns a cost to each variable.
Definition functional.h:155
function< void(Arg)> consumer
Consumer function of value(s) of type(s) Args.
Definition functional.h:60
generator< typename ForwardIt::value_type > make_generator(ForwardIt &begin, ForwardIt &end)
Wrap a begin and end iterator pair into a generator function.
Definition functional.h:176
std::function< TypeSignature > function
General-purpose polymorphic function wrapper.
Definition functional.h:38
function< bool(Args...)> predicate
Predicate function given value(s) of type(s) Args.
Definition functional.h:48
consumer< ValueType > make_consumer(OutputIt &iter)
Wrap an iterator into a consumer function.
Definition functional.h:67
Core types.
Definition adiar.h:40
std::out_of_range out_of_range
Attempt to access elements outside of the given range.
Definition exception.h:43
std::optional< T > optional
An optional value, i.e. a possibly existent value.
Definition types.h:81