KUMI v5.0.0
Gorgeous Garnet
Loading...
Searching...
No Matches
Helper Types and Functions

Utilities to manipulate functions and types in a functional way. More...

Classes

class  kumi::function::boolean_and
 logical and monoid whose identity element is true. More...
class  kumi::function::boolean_or
 logical or monoid whose identity element is false. More...
class  kumi::function::boolean_xor
 logical xor monoid whose identity element is false. More...
class  kumi::function::foldable< T >
 Functional wrapper for values to facilitate pipelined transformations. More...
class  kumi::function::numeric_add
 Addition monoid whose identity element is 0. More...
class  kumi::function::numeric_prod
 Multiplication monoid whose identity element is 1. More...
class  kumi::function::scannable< F, V >
 Functional wrapper that accumulates state during a transformation chain. More...

Typedefs

template<bool... Bs>
using kumi::function::adjacent_index_sequence
 A helper alias template generating the index map associated to the adjacent unicity operation.
template<typename Sizes, typename Elts>
using kumi::function::cartesian_strides = decltype(kumi_implementation_defined)
 A helper alias template computing the strides associated to the cartesian product operation.
template<typename... Ts>
using kumi::function::cat_index_sequence = decltype(kumi_implementation_defined)
 A helper alias template computing the index map associated to the concatenation operation.
template<std::size_t I, typename T, typename U>
using kumi::function::element_or_t = std::remove_cvref_t<decltype(kumi::function::get_or<I>(std::declval<T>(), std::declval<U>()))>
 Computes the Ith element type of a kumi::product_type, or a fallback type U otherwise.
template<std::size_t E, std::size_t N>
using kumi::function::fill_index_sequence = decltype(kumi_implementation_defined)
 A helper alias template generating an index sequence repeating a constant value.
template<typename T>
using kumi::function::indexes_for = std::make_index_sequence<kumi::size_v<T>>
 A helper alias template extracting the projection map associated to a given kumi::concepts::product_type.
template<std::size_t N, std::size_t B, std::size_t E, std::size_t S = 1>
using kumi::function::remove_index_sequence
 A helper alias template generating the index sequence associated to the remove operation.
template<std::size_t N>
using kumi::function::reverse_index_sequence = decltype(kumi_implementation_defined)
 A helper alias template computing the reversed index sequence.
template<std::size_t R, std::size_t N>
using kumi::function::rotate_index_sequence = decltype(kumi_implementation_defined)
 A helper alias template computing the index_sequence associated to the rotation operation.
template<bool... Bs>
using kumi::function::select_index_sequence
 A helper alias template generating the positions of the true flags in a pack of booleans.
template<std::size_t O, std::size_t N>
using kumi::function::shift_index_sequence = decltype(kumi_implementation_defined)
 A helper alias template computing linear indexing translations.
template<std::size_t B, std::size_t E, std::size_t S = 1>
using kumi::function::slice_index_sequence
 A helper alias template computing the index map associated to the slicing (begin, end, step) operation.
template<bool... Bs>
using kumi::function::unique_index_sequence
 A helper alias template generating the index map associated to the unique operations.

Functions

template<typename C, typename... Ts>
requires (std::is_move_constructible_v<std::decay_t<C>> && (std::is_move_constructible_v<std::decay_t<Ts>> && ...))
constexpr auto kumi::bind_back (C &&c, Ts &&... ts) noexcept(std::is_nothrow_move_constructible_v< std::decay_t< C > > &&(std::is_nothrow_move_constructible_v< std::decay_t< Ts > > &&...))
 Returns a callable object with ts bound as its trailing arguments, reducing c arity.
template<typename C, typename... Ts>
requires (std::is_move_constructible_v<std::decay_t<C>> && (std::is_move_constructible_v<std::decay_t<Ts>> && ...))
constexpr auto kumi::bind_front (C &&c, Ts &&... ts) noexcept(std::is_nothrow_move_constructible_v< std::decay_t< C > > &&(std::is_nothrow_move_constructible_v< std::decay_t< Ts > > &&...))
 Returns a callable object with ts bound as its leading arguments, reducing c arity.
template<std::size_t I, typename T, typename V>
constexpr decltype(auto) kumi::function::get_or (T &&t, V &&v)
 Returns the Ith element of t if t is a kumi::product_type, an instance of v otherwise.
template<typename C, typename... Ts>
constexpr decltype(auto) kumi::invoke (C &&c, Ts &&... ts)
 Invoke the Callable object c with a pack of arguments.
template<typename R, typename C, typename... Ts>
requires (std::is_invocable_r_v<R, C, Ts...>)
constexpr R kumi::invoke_r (C &&c, Ts &&... ts) noexcept(std::is_nothrow_invocable_r_v< R, C, Ts... >)
 Invoke the Callable object c with a pack of arguments with return type R.

Variables

constexpr kumi::function::boolean_and kumi::function::bit_and {}
 Callable object matching the kumi::boolean_and monoid, usable with kumi::algorithm.
constexpr kumi::function::boolean_or kumi::function::bit_or {}
 Callable object matching the kumi::boolean_or monoid, usable with kumi::algorithm.
constexpr kumi::function::boolean_xor kumi::function::bit_xor {}
 Callable object matching the kumi::boolean_xor monoid, usable with kumi::algorithm.
constexpr kumi::function::numeric_prod kumi::function::multiplies {}
 Callable object matching the kumi::numeric_prod monoid, usable with kumi::algorithm.
constexpr kumi::function::numeric_add kumi::function::plus {}
 Callable object matching the kumi::numeric_add monoid, usable with kumi::algorithm.
template<typename T, auto V>
constexpr auto kumi::function::size_or_v = V
 If T is a kumi::product_type, returns its number of elements otherwise returns V;.