1#ifndef ADIAR_FUNCTIONAL_H
2#define ADIAR_FUNCTIONAL_H
9#include <adiar/exception.h>
10#include <adiar/type_traits.h>
11#include <adiar/types.h>
40 template <
typename TypeSignature>
50 template <
typename...
Args>
63 template <
typename Arg>
69 template <
typename ValueType,
typename OutputIt>
100 using value_type =
typename std::remove_reference_t<OutputIt>::container_type::value_type;
114 template <
typename ForwardIt>
118 using value_type =
typename ForwardIt::value_type;
122 throw out_of_range(
"Iterator range unable to contain all generated values");
135 template <
typename ForwardIt>
140 typename std::iterator_traits<std::remove_reference_t<ForwardIt>>
::value_type;
145 throw out_of_range(
"Iterator range unable to contain all generated values");
157 template <
typename VarType>
171 template <
typename RetType>
177 template <
typename ForwardIt>
181 using value_type =
typename std::remove_reference_t<ForwardIt>::value_type;
193 template <
typename Stream>
197 using value_type =
typename Stream::value_type;
200 if (!
s.can_pull()) {
return {}; }
208 template <
typename RetType>
213 if (
_end) {
return {}; }
function< optional< RetType >()> generator
Generator function that produces a new value of RetType for each call.
Definition functional.h:172
function< double(VarType)> cost
Cost function that assigns a cost to each variable.
Definition functional.h:158
function< void(Arg)> consumer
Consumer function of value of type Arg.
Definition functional.h:64
generator< typename std::remove_reference_t< ForwardIt >::value_type > make_generator(ForwardIt &&begin, ForwardIt &&end)
Wrap a begin and end iterator pair into a generator function.
Definition functional.h:179
std::function< TypeSignature > function
General-purpose polymorphic function wrapper.
Definition functional.h:41
function< bool(Args...)> predicate
Predicate function given value(s) of type(s) Args.
Definition functional.h:51
consumer< ValueType > make_consumer(OutputIt &&iter)
Wrap an iterator into a consumer function.
Definition functional.h:71
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