KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches
kumi Namespace Reference

Main KUMI namespace. More...

Detailed Description

Main KUMI namespace.

Classes

struct  all_unique_names
 Checks if a parameter pack only contains distinct kumi::field names. Evaluates to false if no type is a kumi::field. More...
struct  all_uniques
 Checks if a parameter pack only contains distinct types. More...
struct  apply_traits
 Unpacks a product type and applies its element types as arguments to a meta-function. More...
class  as
 Lightweight type-wrapper. More...
struct  as_tuple
 Generate a kumi::tuple type from a type. More...
class  builder
 kumi::builder provides a generic way of defining a product type. More...
struct  common_product_type
 Extracts the common product_type of a parameter pack. More...
struct  container_size
 Returns the number of elements of a kumi::static_container. More...
struct  container_type
 Provides access to the type of the elements of a kumi::static_container. More...
struct  element
 Provides indexed access to the types of the elements of a kumi::product_type. More...
class  field
 Named wrapper over a type. More...
struct  field< Id, T >
 Specialisation to clearly indicate an error. More...
struct  has_static_size
 Detects if a given kumi::container instance size is static. More...
class  identifier
 identifier definition class More...
class  index_t
 Integral constant type. More...
struct  is_container
 Traits detecting types behaving like a kumi::container. More...
struct  is_equality_comparable
 Checks if a two product types are comparable for equality. More...
struct  is_equivalent
 Checks if a two product types are equivalent. More...
struct  is_homogeneous
 Detects if a given kumi::product_type instance is homogeneous. More...
struct  is_product_type
 Detects if a type follows the tuple protocol. More...
struct  is_projection_map
 Checks if a type can be used as a kumi::projection_map. More...
struct  is_record_type
 Opt-in traits for types behaving like a kumi::product_type. More...
class  label_t
 Literal constant type. More...
struct  map_traits
 Applies a unary meta-function to each element of a product type. More...
struct  member
 Computes the return type of a call to kumi::get. More...
class  name
 Compile-time text based identifier. More...
class  projection_map
 A stateless, compile-time schema for product type transformation. More...
class  record
 Fixed-size collection of heterogeneous tagged fields, tags are unique. More...
struct  size
 Computes the number of elements of a kumi::product_type. More...
struct  stored_element
 Provides indexed access to the types of the elements of a product type and unwraps the returned field for record type. More...
struct  stored_member
 Computes the return type of a call to kumi::get on a kumi::tuple and unwrap the field returned by kumi::get on a kumi::record. More...
class  str
 Static string used to create named fields. More...
class  tuple
 Fixed-size collection of heterogeneous values. More...
class  unit
 A type representing the product of no type also called the unit type. More...
class  unknown
 Type indicating a identifier was not found in a given kumi::product_type. More...

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 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 > > &&...))
 Binds a certain amount of values into a callable reducing it's 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 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 > > &&...))
 Binds a certain amount of values into a callable reducing it's arity.
template<kumi_implementation_defined auto Name, typename T>
decltype(auto) constexpr capture_field (T &&t) noexcept
 Creates a field from a given value keeping the qualifiers.
template<typename U, typename T>
decltype(auto) constexpr field_cast (T &&t) noexcept
 Casts the provided value to the target type using static_cast.
template<typename T>
constexpr decltype(auto) field_value_of (T &&t) noexcept
 Extracts the value from a kumi::concepts::field or returns the parameter.
template<kumi::concepts::identifier Id, kumi::concepts::product_type T>
requires (kumi::concepts::queryable_by_identifier<Id, T>)
consteval auto get_index_of_field ()
 Helper to retrive the index of a type in a product type by it s identifier.
template<kumi::str L, kumi::concepts::product_type T>
requires (kumi::concepts::queryable_by_label<kumi::label_t<L>, T>)
consteval auto get_index_of_label ()
 Helper to retrive the index of a type in a product type by it s identifier.
template<typename U, kumi::concepts::product_type T>
requires (kumi::concepts::queryable_by_type<U, T>)
consteval auto get_index_of_type ()
 Helper to retrive the index of a type in a product type by it s type.
template<typename T>
consteval auto identifier_of () noexcept
 Extracts the identifiers from a kumi::concepts::field or returns the parameter.
template<concepts::identifier... Ts>
consteval auto identifiers (Ts...) noexcept
 Creates a kumi::projection_map object, deducing the target type from the types of arguments.
template<concepts::index... Ts>
consteval auto indexes (Ts...) noexcept
 Creates a kumi::projection_map object, deducing the target type from the types of arguments.
template<typename C, typename... Ts>
constexpr decltype(auto) 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 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.
template<typename T>
consteval str label_of () noexcept
 Extracts the label from a kumi::concepts::field or returns the parameter.
template<std::convertible_to< std::size_t > auto... vs>
consteval auto make_indexes () noexcept
 Creates a kumi::projection_map object, deducing the target type from the types of arguments.
template<char... c>
constexpr auto operator""_c () noexcept
 Forms a integral constant literal of the desired value.
template<kumi::str ID>
constexpr auto operator""_id () noexcept
 Forms a constant string literal of the desired value.
template<kumi::str ID>
constexpr auto operator""_l () noexcept
 Forms a constant string literal of the desired value.
template<kumi::concepts::identifier L, kumi::concepts::identifier R>
constexpr bool operator== (L const &, R const &)
 identifier comparison
template<template< class > class Pred>
constexpr auto predicate () noexcept
 Convert a unary template meta-program in a running predicate.
template<concepts::projection... Ts>
KUMI_CUDA projection_map (Ts...) -> projection_map< Ts
 kumi::projection_map deduction guide

Variables

constexpr all_of_t all_of {}
 Callable object checking if a unary predicate p returns true for every element of t.
constexpr all_unique_t all_unique {}
 Callable object returning a product type containing the values of the first occurence of each type in t.
constexpr any_of_t any_of {}
 Callable object checking if a unary predicate p returns true for any element of t.
constexpr apply_t apply {}
 Callable object invoking the callable object f with the elements of the product type unrolled as arguments.
constexpr apply_field_t apply_field {}
 Callable object invoking the callable object f with the elements of the product type unrolled as arguments.
constexpr as_flat_ptr_t as_flat_ptr {}
 Callable object converting recursively a product type of product types into a flat product type of pointers to each of its components.
constexpr back_t back {}
 Callable object used to retrieve the back of a product type.
constexpr bit_and_t bit_and {}
 Callable object computing the bitwise AND of all elements.
constexpr bit_or_t bit_or {}
 Callable object computing the bitwise OR of all elements.
constexpr bit_xor_t bit_xor {}
 Callable object computing the bitwise XOR of all elements.
constexpr cartesian_product_t cartesian_product {}
 Callable object returning the Cartesian Product of all elements of its arguments product types.
constexpr cat_t cat {}
 Callable object concatenating multiple product types into a single one.
template<std::size_t N>
constexpr tiles_t< N, N > chunks {}
 Callable object creating a tuple of product types, each containing N consecutive elements from t. Chunks starts at 0 and advance by N element each time.
constexpr compress_t compress {}
 Callable object converting a product type of product type into a single product type recursively, or returns the input.
constexpr contains_t contains {}
 Callable object checking if a product type contains a given identifier.
constexpr contains_any_t contains_any {}
 Callable object checking if a product type contains at least one of many identifier.
constexpr contains_none_t contains_none {}
 Callable object checking if a product type contains no fields based on any of the selected identifier.
constexpr contains_only_t contains_only {}
 Callable object checking if a product type contains fields based on on selected identifier.
constexpr count_t count {}
 Callable object counting the number of elements of t not equivalent to false.
constexpr count_if_t count_if {}
 Callable object counting the number of elements of t satisfying predicates p.
constexpr exclusive_scan_left_t exclusive_scan_left {}
 Callable object computing the exclusive prefix scan of all elements of a product type using a tail recursive call.
constexpr exclusive_scan_right_t exclusive_scan_right {}
 Callable object computing the exclusive suffix scan of all elements of a product type using a non-tail recursive call.
constexpr extract_t extract {}
 Callable object extracting a sub product type from a product type.
template<std::size_t N>
constexpr fill_t< N > fill {}
 Callable object creating a kumi::tuple containing N copies of v.
template<template< typename > typename Pred>
constexpr filter_t< Pred > filter {}
 Callable object filtering a product type over a predicate.
template<template< typename > typename Pred>
constexpr filter_not_t< Pred > filter_not {}
 Callable object filtering a product type over a predicate.
constexpr flatten_t flatten {}
 Callable object converting a product type of product types into a product type of all elements.
constexpr flatten_all_t flatten_all {}
 Callable object converting recursively a product type of product types into a product type of all elements.
constexpr fold_left_t fold_left {}
 Callable object computing the generalized combination of all elements using a tail recursive call.
constexpr fold_right_t fold_right {}
 Callable object computing the generalized combination of all elements using a non-tail recursive call.
constexpr for_each_t for_each {}
 Callable object applying the Callable object f on each element of a product type.
constexpr front_t front {}
 Callable object used to retrieve the front of a product type.
template<std::size_t N>
constexpr generate_t< N > generate {}
 Callable object creating a kumi::tuple containing N applications of the f Callable.
template<template< class > typename Traits>
constexpr traits_check< Traits > if_ = {}
 Option specifying a traits that type should verify for being used as a identifier value.
constexpr inclusive_scan_left_t inclusive_scan_left {}
 Callable object computing the inclusive prefix scan of all elements of a product type using a tail recursive call.
constexpr inclusive_scan_right_t inclusive_scan_right {}
 Callable object computing the inclusive suffix scan of all elements of a product type using a non-tail recursive call.
template<std::size_t N>
constexpr kumi::index_t< N > const index = {}
 Inline integral constant value for kumi::index_t.
template<std::size_t N>
constexpr iota_t< N > iota {}
 Callable object creating a kumi::tuple containing an increasing ramp of values.
template<str Label>
constexpr kumi::label_t< Label > label = {}
 Inline literal constant value for kumi::label_t.
constexpr locate_t locate {}
 Callable object Returning the index of a value which type satisfies a given predicate.
constexpr map_t map {}
 Callable object applying the Callable object f on each product types' elements.
constexpr map_field_t map_field {}
 Callable object applying the Callable object f on each product types elements and their associated labels.
constexpr map_index_t map_index {}
 Callable object applying the Callable object f on each product types elements and their indexes.
constexpr map_reduce_t map_reduce {}
 Callable object performing a tree-like reduction of all elements of a product type. The given map function is applied before excution the reduction to each element of the input.
constexpr max_t max {}
 Callable object computing the maximum value of all elements of t.
template<typename T>
constexpr member_cast_t< T > member_cast {}
 Callable object converting a product_type<Ts...> to an instance of a product_type<Target...>.
constexpr min_t min {}
 Callable object computing the maximum value of applications of f to all elements of kumi::flatten_all(t).
constexpr kumi::unit none {}
 Inline constant representing a kumi::unit.
constexpr none_of_t none_of {}
 Callable object checking if a unary predicate p does not returns true for any element in t.
template<typename T>
constexpr kumi::only_t< T > only = {}
 Option specifying the single type a identifier will accept.
template<template< typename > typename Pred>
constexpr partition_t< Pred > partition {}
 Callable object partitionning a product type over a predicate.
constexpr pop_front_t pop_front {}
 Callable object removing the first (if any) element of t.
constexpr prod_t prod {}
 Callable object computing the product of all elements.
constexpr push_front_t push_front {}
 Callable object constructing a product type by adding a value v at the beginning of t.
constexpr reduce_t reduce {}
 Callable object performing a tree-like reduction of all elements of a product type.
template<kumi::concepts::projection_map auto Projections>
constexpr reindex_t< Projections > reindex {}
 Callable object reindex elements of a Product Type.
constexpr remove_t remove {}
 Callable object removing a sub product type from a product type.
template<std::size_t... I>
constexpr reorder_t< I... > reorder {}
 Callable object reordering elements of a product type.
template<kumi::concepts::identifier auto... Name>
constexpr reorder_fields_t< Name... > reorder_fields {}
 Callable object reordering elements of a Record Type.
template<std::size_t R>
constexpr rotate_left_t< R > rotate_left {}
 Callable object.
template<std::size_t R>
constexpr rotate_right_t< R > rotate_right {}
 Callable object.
constexpr split_t split {}
 Callable object splitting a product type into two.
constexpr sum_t sum {}
 Callable object computing the sum of all elements.
template<std::size_t N, std::size_t O>
constexpr tiles_t< N, O > tiles {}
 Callable object creating a tuple of product types, each containing N consecutive elements from t. Tiles starts at 0 and advance by O element each time.
constexpr transpose_t transpose {}
 Callable object transposing a product type of product types by shifting elements in their transposed position always returning a tuple as the external product type.
constexpr unique_t unique {}
 Callable object returning a product type with consecutive duplicate types removed (pairwise uniqueness).
template<std::size_t N>
constexpr tiles_t< N, 1 > windows {}
 Callable object creating a tuple of product types, each containing N consecutive elements from t. Windows starts at 0 and advance by 1 element each time.
constexpr zip_t zip {}
 Callable object constructing a tuple where the ith element is the product type of all ith elements of t0,ts...
constexpr zip_max_t zip_max {}
 Callable object constructing a tuple where the ith element is the product type of all ith elements of t0,ts...
constexpr zip_min_t zip_min {}
 Callable object constructing a tuple where the ith element is the product type of all ith elements of t0,ts...

Tuple conversions

template<typename Type, typename... Ts>
requires (!kumi::concepts::product_type<Type> && kumi_implementation_defined)
constexpr auto from_tuple (tuple< Ts... > const &t)
 Converts a kumi::tuple to an instance of an arbitrary type.
template<kumi::concepts::product_type T>
constexpr auto to_tuple (T &&t)
 Converts a kumi::product_type to an instance kumi::tuple.
template<kumi::concepts::static_container S>
requires (!kumi::concepts::product_type<S>)
constexpr auto to_tuple (S &&s)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Record construction

template<kumi::concepts::identifier auto... Fields, typename... Ts>
constexpr auto tie (Ts &... ts) -> kumi::record< kumi::field< decltype(Fields), Ts & >... > requires(sizeof...(Fields)==sizeof...(Ts))
 Creates a kumi::record of lvalue references to its arguments.
template<kumi::concepts::identifier auto... Fields, typename... Ts>
constexpr auto forward_as_record (Ts &&... ts) -> kumi::record< kumi::field< decltype(Fields), Ts && >... > requires(sizeof...(Fields)==sizeof...(Ts))
 Creates a kumi::record of forwarding references to its arguments.
template<typename... Ts>
constexpr auto make_record (Ts &&... ts) -> kumi::record< std::unwrap_ref_decay_t< Ts >... > requires(kumi::concepts::uniquely_named< Ts... > &&kumi::concepts::fully_named< Ts... >)
 Creates a record object, deducing the target type from the types of arguments.
template<kumi::concepts::record_type R>
constexpr auto to_ref (R &&r)
 Creates a kumi::record of references given a reference to a kumi::record_type.

Record conversion

template<kumi::concepts::record_type Type, typename... Ts>
requires ( kumi::concepts::equivalent<typename kumi_implementation_defined::type, kumi::tuple<Ts...>>)
constexpr auto from_record (record< Ts... > const &r)
 Converts a kumi::record to an instance of a type that models kumi::record_type.
template<kumi::concepts::record_type Type>
constexpr auto to_record (Type &&r)
 Converts a kumi::record_type to an instance kumi::record.

Tuple construction

template<typename... Ts>
constexpr auto tie (Ts &... ts) -> kumi::tuple< Ts &... >
 Creates a kumi::tuple of lvalue references to its arguments.
template<typename... Ts>
constexpr auto forward_as_tuple (Ts &&... ts) -> kumi::tuple< Ts &&... >
 Creates a kumi::tuple of forwarding references to its arguments.
template<typename... Ts>
constexpr auto make_tuple (Ts &&... ts) -> kumi::tuple< std::unwrap_ref_decay_t< Ts >... >
 Creates a tuple object, deducing the target type from the types of arguments.
template<kumi::concepts::product_type T>
constexpr auto to_ref (T &&t)
 Creates a kumi::tuple of references given a reference to a kumi::product_type.

Record Deduction Guides

template<typename... Ts>
KUMI_CUDA record (Ts &&...) -> record< std::unwrap_ref_decay_t< Ts >... >
 kumi::record deduction guide

Record accessors

template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &r) noexcept
 Extracts the Ith field from a kumi::record.
template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &&r) noexcept
template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (record< Ts... > const &r) noexcept
template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (record< Ts... > const &&r) noexcept
template<kumi::str L, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &r) noexcept
 Extracts the element of the field labeled L from a kumi::record if it exists.
template<kumi::str L, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &&r) noexcept
template<kumi::str L, typename... Ts>
decltype(auto) constexpr get (record< Ts... > const &r) noexcept
template<kumi::str L, typename... Ts>
decltype(auto) constexpr get (record< Ts... > const &&r) noexcept
template<kumi::concepts::identifier auto Id, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &r) noexcept
 Extracts the field identified by Id from a kumi::record if it exists.
template<kumi::concepts::identifier auto Id, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &&r) noexcept
template<kumi::concepts::identifier auto Id, typename... Ts>
decltype(auto) constexpr get (record< Ts... > const &r) noexcept
template<kumi::concepts::identifier auto Id, typename... Ts>
decltype(auto) constexpr get (record< Ts... > const &&r) noexcept
template<typename T, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &r) noexcept
 Extracts the field which underlying type is T from a kumi::record if it exist.
template<typename T, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &&r) noexcept
template<typename T, typename... Ts>
decltype(auto) constexpr get (record< Ts... > const &r) noexcept
template<typename T, typename... Ts>
decltype(auto) constexpr get (record< Ts... > const &&r) noexcept

Tuple deduction guides

template<typename... Ts>
KUMI_CUDA tuple (Ts &&...) -> tuple< std::unwrap_ref_decay_t< Ts >... >
 kumi::tuple deduction guide

Tuple properties

template<kumi::concepts::product_type T>
constexpr auto members_of (as< T >) noexcept
 Extracts the names of the fields of a kumi::product_type.
template<kumi::concepts::product_type T>
constexpr auto values_of (T &&t) noexcept
 Extracts the values of the fields of a kumi::product_type.

Tuple Accessors

template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &t) noexcept
 Extracts the Ith element from a kumi::tuple.
template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &&arg) noexcept
template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > const &arg) noexcept
template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > const &&arg) noexcept
template<kumi::str L, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &t) noexcept
 Extracts the field labeled L from a kumi::tuple if it exists.
template<kumi::str L, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &&t) noexcept
template<kumi::str L, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > const &t) noexcept
template<kumi::str L, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > const &&t) noexcept
template<kumi::concepts::identifier auto Id, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &t) noexcept
 Extracts the field identified by Id from a kumi::tuple if it exists.
template<kumi::concepts::identifier auto Id, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &&t) noexcept
template<kumi::concepts::identifier auto Id, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > const &t) noexcept
template<kumi::concepts::identifier auto Id, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > const &&t) noexcept
template<typename T, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &t) noexcept
 Extracts the field which type is T from a kumi::tuple if it exist.
template<typename T, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &&t) noexcept
template<typename T, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > const &t) noexcept
template<typename T, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > const &&t) noexcept