kumi v3.1.0
Exquisite Epidote
 
Loading...
Searching...
No Matches
kumi Namespace Reference

Main KUMI namespace. More...

Detailed Description

Main KUMI namespace.

Classes

struct  as_tuple
 Generate a kumi::tuple type from a type. More...
 
struct  element
 Provides indexed access to the types of the elements of a kumi::product_type. More...
 
struct  index_t
 Integral constant type. More...
 
struct  is_homogeneous
 Detects if a given kwk::product_type instance is homogeneous. More...
 
struct  is_product_type
 Opt-in traits for types behaving like a kumi::product_type. More...
 
struct  member
 Computes the return type of a call to kumi::get. More...
 
struct  size
 Computes the number of elements of a kumi::product_type. More...
 
class  tuple
 Fixed-size collection of heterogeneous values. More...
 

Concepts

concept  std_tuple_compatible
 Concept specifying a type is a standard tuple-like type.
 
concept  product_type
 Concept specifying a type follows the Product Type semantic.
 
concept  sized_product_type
 Concept specifying a type follows the Product Type semantic and has a known size.
 
concept  sized_product_type_or_more
 Concept specifying a type follows the Product Type semantic and has a size lower bound.
 
concept  non_empty_product_type
 Concept specifying a type follows the Product Type semantic and is non-empty.
 
concept  homogeneous_product_type
 Concept specifying is Product Type which types are all the same.
 
concept  equality_comparable
 Concept specifying if a type is comparable for each of its components.
 

Functions

template<typename T >
constexpr auto all_of (T const &ts) noexcept
 Computes the reduction of a tuple over the && operator.
 
template<typename Pred , typename T >
constexpr auto all_of (T const &ts, Pred p) noexcept
 Checks if unary predicate p returns true for all elements in the value t.
 
template<typename T >
constexpr auto any_of (T const &ts) noexcept
 Computes the reduction of a tuple over the || operator.
 
template<typename Pred , typename T >
constexpr auto any_of (T const &ts, Pred p) noexcept
 Checks if unary predicate p returns true for any elements in the value t.
 
template<typename Function , product_type Tuple>
requires _::supports_apply<Function&&, Tuple&&>
constexpr decltype(auto) apply (Function &&f, Tuple &&t) noexcept(_::supports_nothrow_apply< Function &&, Tuple && >)
 Invoke the Callable object f with a tuple of arguments.
 
template<product_type Tuple>
KUMI_TRIVIAL_NODISCARD auto as_flat_ptr (Tuple &&ts) noexcept
 Convert a kumi::product_type to a flat tuple of pointers to each its components.
 
template<product_type Tuple>
requires ( size_v<Tuple> != 0)
KUMI_TRIVIAL_NODISCARD constexpr decltype(auto) back (Tuple &&t)
 Retrieves the back of a tuple.
 
template<product_type Tuple>
constexpr auto bit_and (Tuple &&t)
 Computes the bitwise AND of all elements.
 
template<product_type Tuple, typename Value >
constexpr auto bit_and (Tuple &&t, Value init)
 Computes the bitwise AND of all elements.
 
template<product_type Tuple>
constexpr auto bit_or (Tuple &&t)
 Computes the bitwise OR of all elements.
 
template<product_type Tuple, typename Value >
constexpr auto bit_or (Tuple &&t, Value init)
 Computes the bitwise OR of all elements.
 
template<product_type... Ts>
constexpr auto cartesian_product (Ts &&... ts)
 Return the Cartesian Product of all elements of its arguments product types.
 
template<product_type... Tuples>
KUMI_TRIVIAL_NODISCARD constexpr auto cat (Tuples &&... ts)
 Concatenates tuples in a single one.
 
template<typename T >
KUMI_TRIVIAL_NODISCARD constexpr std::size_t count (T const &ts) noexcept
 Counts the number of elements of t not equivalent to false.
 
template<typename Pred , typename T >
constexpr std::size_t count_if (T const &ts, Pred p) noexcept
 Counts the number of elements of t satisfying predicates p.
 
template<std::size_t I0, product_type Tuple>
requires (I0<= size_v<Tuple>)
KUMI_TRIVIAL_NODISCARD constexpr auto extract (Tuple const &t, index_t< I0 > i0) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<std::size_t I0, std::size_t I1, product_type Tuple>
requires ( (I0 <= size_v<Tuple>) && (I1 <= size_v<Tuple>) )
constexpr auto extract (Tuple const &t, index_t< I0 > i0, index_t< I1 > i1) noexcept
 Extracts a sub-tuple from a product type.
 
template<product_type Tuple>
constexpr auto flatten (Tuple const &ts)
 Converts a tuple of tuples into a tuple of all elements.
 
template<product_type Tuple>
constexpr auto flatten_all (Tuple &&ts)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<product_type Tuple, typename Func >
constexpr auto flatten_all (Tuple &&ts, Func &&f)
 Recursively converts a tuple of tuples into a tuple of all elements.
 
template<typename Function , sized_product_type_or_more< 1 > Tuple>
constexpr auto fold_left (Function f, Tuple &&t)
 Computes the generalized associative sum of all elements using a tail recursive call.
 
template<typename Function , product_type Tuple, typename Value >
constexpr auto fold_left (Function f, Tuple &&t, Value init)
 Computes the generalized sum of all elements using a tail recursive call.
 
template<typename Function , sized_product_type_or_more< 1 > Tuple>
constexpr auto fold_right (Function f, Tuple &&t)
 Computes the generalized associative sum of all elements using a non-tail recursive call.
 
template<typename Function , product_type Tuple, typename Value >
constexpr auto fold_right (Function f, Tuple &&t, Value init)
 Computes the generalized sum of all elements using a non-tail recursive call.
 
template<typename Function , product_type Tuple, product_type... Tuples>
requires _::supports_call<Function&, Tuple, Tuples...>
constexpr void for_each (Function f, Tuple &&t, Tuples &&... ts)
 Applies the Callable object f on each element of a kumi::product_type.
 
template<typename Function , product_type Tuple, product_type... Tuples>
constexpr void for_each_index (Function f, Tuple &&t, Tuples &&... ts)
 Applies the Callable object f on each element of a kumi::product_type and its index.
 
template<typename Type , typename... Ts>
requires (!product_type<Type> && _::implicit_constructible<Type, Ts...>)
constexpr auto from_tuple (tuple< Ts... > const &t)
 Converts a kumi::tuple to an instance of an arbitrary type.
 
template<product_type Tuple>
requires ( size_v<Tuple> != 0)
KUMI_TRIVIAL_NODISCARD constexpr decltype(auto) front (Tuple &&t)
 Retrieves the front of a tuple.
 
template<std::size_t N, typename T >
constexpr auto generate (T const &v) noexcept
 Creates a kumi::tuple containing N copies of v.
 
template<product_type S1, sized_product_type< S1::size()> S2, typename T >
constexpr auto inner_product (S1 const &s1, S2 const &s2, T init) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<product_type S1, sized_product_type< S1::size()> S2, typename T , typename Sum , typename Prod >
constexpr auto inner_product (S1 const &s1, S2 const &s2, T init, Sum sum, Prod prod) noexcept
 Computes inner product (i.e. sum of products)
 
template<std::size_t N, typename T >
constexpr auto iota (T v) noexcept
 Creates a kumi::tuple containing an increasing ramp of values.
 
template<typename Pred , typename... Ts>
constexpr auto locate (tuple< Ts... > const &t, Pred p) noexcept
 Return the index of a value which type satisfies a given predicate.
 
template<product_type Tuple, typename Function , sized_product_type< size< Tuple >::value >... Tuples>
requires _::supports_call<Function, Tuple&&, Tuples&&...>
constexpr auto map (Function f, Tuple &&t0, Tuples &&...others)
 Apply the Callable object f on each tuples' elements.
 
template<product_type Tuple, typename Function , sized_product_type< size< Tuple >::value >... Tuples>
constexpr auto map_index (Function f, Tuple &&t0, Tuples &&...others)
 Apply the Callable object f on each tuples' elements and their indexes.
 
template<typename T >
constexpr auto max (T const &t) noexcept
 Computes the maximum value all elements of t.
 
template<typename T , typename F >
constexpr auto max (T const &t, F f) noexcept
 Computes the maximum value of applications of f to all elements of t.
 
template<typename T , typename F >
constexpr auto max_flat (T const &t, F f) noexcept
 Computes the maximum value of applications of f to all elements of kumi::flatten_all(t).
 
template<typename T >
constexpr auto min (T const &t) noexcept
 Computes the minimum value all elements of t.
 
template<typename T , typename F >
constexpr auto min (T const &t, F f) noexcept
 Computes the minimum value of applications of f to all elements of t.
 
template<typename T , typename F >
constexpr auto min_flat (T const &t, F f) noexcept
 Computes the minimum value of applications of f to all elements of kumi::flatten_all(t).
 
template<typename Tuple >
KUMI_TRIVIAL_NODISCARD constexpr bool none_of (Tuple const &ts) noexcept
 Checks no elements of a tuple are true.
 
template<typename Pred , typename Tuple >
KUMI_TRIVIAL_NODISCARD constexpr bool none_of (Tuple const &ts, Pred p) noexcept
 Checks if unary predicate p returns true for no elements in the value t.
 
template<template< typename > typename Pred, kumi::product_type T>
constexpr auto partition (T &&tup) noexcept
 Partition a tuple over a predicate.
 
template<product_type Tuple>
constexpr auto pop_back (Tuple const &t)
 Remove the last (if any) element of a kumi::product_type.
 
template<product_type Tuple>
constexpr auto pop_front (Tuple const &t)
 Remove the first (if any) element of a kumi::product_type.
 
template<template< class > class Pred>
constexpr auto predicate () noexcept
 Convert a unary template meta-program in a running predicate.
 
template<product_type Tuple>
constexpr auto prod (Tuple &&t)
 Computes the product of all elements.
 
template<product_type Tuple, typename Value >
constexpr auto prod (Tuple &&t, Value init)
 Computes the product of all elements.
 
template<product_type Tuple, typename T >
constexpr auto push_back (Tuple const &t, T &&v)
 Constructs a tuple by adding a value v at the end of t.
 
template<product_type Tuple, typename T >
constexpr auto push_front (Tuple const &t, T &&v)
 Constructs a tuple by adding a value v at the beginning of t.
 
template<std::size_t... Idx, product_type Tuple>
requires ((Idx < size_v<Tuple>) && ...)
KUMI_TRIVIAL_NODISCARD constexpr auto reorder (Tuple &&t)
 Reorder elements of a kumi::product_type.
 
template<product_type Tuple>
constexpr auto reverse (Tuple &&t)
 Reverse elements of a kumi::product_type.
 
template<std::size_t I0, product_type Tuple>
requires (I0 <= size_v<Tuple>)
constexpr auto split (Tuple const &t, index_t< I0 > i0) noexcept
 Split a tuple into two.
 
template<product_type Tuple>
constexpr auto sum (Tuple &&t)
 Computes the sum of all elements.
 
template<product_type Tuple, typename Value >
constexpr auto sum (Tuple &&t, Value init)
 Computes the sum of all elements.
 
template<product_type Type>
constexpr auto to_tuple (Type &&t)
 Converts a kumi::product_type to an instance kumi::tuple.
 
template<product_type Tuple>
constexpr auto transpose (Tuple const &t)
 Transpose a tuple of tuples by shifting elements in their transposed position.
 
template<product_type T0, sized_product_type< size_v< T0 > >... Ts>
constexpr auto zip (T0 const &t0, Ts const &...ts)
 Constructs a tuple where the ith element is the tuple of all ith elements of ts...
 
Accessors
template<std::size_t I, typename... Ts>
requires (I < sizeof...(Ts))
KUMI_TRIVIAL_NODISCARD constexpr decltype(auto) get (tuple< Ts... > &&arg) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<std::size_t I, typename... Ts>
requires (I < sizeof...(Ts))
KUMI_TRIVIAL_NODISCARD constexpr decltype(auto) get (tuple< Ts... > const &arg) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<std::size_t I, typename... Ts>
requires (I < sizeof...(Ts))
KUMI_TRIVIAL_NODISCARD constexpr decltype(auto) get (tuple< Ts... > const &&arg) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Variables

template<std::size_t N>
constexpr index_t< N > const index = {}
 Inline integral constant value for kumi::index_t.