kumi v3.1.0
Exquisite Epidote
 
Loading...
Searching...
No Matches
kumi::tuple< Ts > Class Template Reference

Fixed-size collection of heterogeneous values. More...

#include <kumi/tuple.hpp>

Detailed Description

template<typename... Ts>
class kumi::tuple< Ts >

Fixed-size collection of heterogeneous values.

kumi::tuple provides an aggregate based implementation of a tuple. It provides algorithms and functions designed to facilitate tuple's handling and transformations.

kumi::tuple is also compatible with standard tuple operations and structured bindings.

Template Parameters
TsSequence of types stored inside kumi::tuple.

Public Member Functions

template<typename Function >
KUMI_TRIVIAL constexpr decltype(auto) operator() (Function &&f) const &noexcept(noexcept(kumi::apply(static_cast< decltype(f) && >(f), *this)))
 Invoke the Callable object f on each element of the current tuple.
 
template<typename... Us>
requires (_::piecewise_convertible<tuple, tuple<Us...>>)
constexpr tupleoperator= (tuple< Us... > &&other)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename... Us>
requires (_::piecewise_convertible<tuple, tuple<Us...>>)
constexpr tupleoperator= (tuple< Us... > const &other)
 Replaces the contents of the tuple with the contents of another tuple.
 
Accessors
template<std::size_t I>
requires (I < sizeof...(Ts))
KUMI_TRIVIAL constexpr decltype(auto) operator[] (index_t< I > i) &noexcept
 Extracts the Ith element from a kumi::tuple.
 
template<std::size_t I>
requires (I < sizeof...(Ts))
KUMI_TRIVIAL constexpr decltype(auto) operator[] (index_t< I >) &&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>
requires (I < sizeof...(Ts))
KUMI_TRIVIAL constexpr decltype(auto) operator[] (index_t< I >) const &&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>
requires (I < sizeof...(Ts))
KUMI_TRIVIAL constexpr decltype(auto) operator[] (index_t< I >) const &noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
Conversions
template<typename... Us>
requires ( _::piecewise_convertible<tuple, tuple<Us...>> && (sizeof...(Us) == sizeof...(Ts)) && (!std::same_as<Ts, Us> && ...) )
constexpr auto cast () const
 Converts a tuple<Ts...> to a tuple<Us...>.
 

Static Public Member Functions

Properties
static KUMI_TRIVIAL_NODISCARD constexpr auto size () noexcept
 Returns the number of elements in a kumi::tuple.
 
static KUMI_TRIVIAL_NODISCARD constexpr bool empty () noexcept
 Returns true if a kumi::tuple contains 0 elements.
 

Related Functions

(Note that these are not member functions.)

template<typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &os, tuple const &t) noexcept
 Inserts a kumi::tuple in an output stream.
 
Tuple construction
template<typename... Ts>
 tuple (Ts &&...) -> tuple< typename std::unwrap_ref_decay< Ts >::type... >
 kumi::tuple deduction guide
 
template<typename... Ts>
KUMI_TRIVIAL_NODISCARD constexpr tuple< Ts &... > tie (Ts &...ts)
 Creates a kumi::tuple of lvalue references to its arguments.
 
template<typename... Ts>
KUMI_TRIVIAL_NODISCARD constexpr tuple< Ts &&... > forward_as_tuple (Ts &&...ts)
 Creates a kumi::tuple of forwarding references to its arguments.
 
template<typename... Ts>
KUMI_TRIVIAL_NODISCARD constexpr tuple< typename std::unwrap_ref_decay< Ts >::type... > make_tuple (Ts &&...ts)
 Creates a tuple object, deducing the target type from the types of arguments.
 
template<product_type Type>
KUMI_TRIVIAL_NODISCARD constexpr auto to_ref (Type &&t)
 Creates a kumi::tuple of references given a reference to a kumi::product_type.
 
Accessors
template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &t) noexcept
 Extracts the Ith element from a kumi::tuple.
 

Comparison operators

template<typename... Us>
requires ( equality_comparable<tuple,tuple<Us...>> )
constexpr auto operator== (tuple const &self, tuple< Us... > const &other) noexcept
 Compares a tuple with an other for equality.
 
template<typename... Us>
requires (sizeof...(Ts) == sizeof...(Us) && _::piecewise_ordered<tuple, tuple<Us...>>)
constexpr auto operator< (tuple const &lhs, tuple< Us... > const &rhs) noexcept
 Compares tuples for lexicographical is less relation.
 
template<typename... Us>
requires requires { rhs < lhs; }
KUMI_TRIVIAL friend constexpr auto operator<= (tuple const &lhs, tuple< Us... > const &rhs) noexcept
 Compares tuples for lexicographical is less or equal relation.
 
template<typename... Us>
requires requires { rhs < lhs; }
KUMI_TRIVIAL friend constexpr auto operator> (tuple const &lhs, tuple< Us... > const &rhs) noexcept
 Compares tuples for lexicographical is greater relation.
 
template<typename... Us>
requires requires { lhs < rhs; }
KUMI_TRIVIAL friend constexpr auto operator>= (tuple const &lhs, tuple< Us... > const &rhs) noexcept
 Compares tuples for lexicographical is greater relation relation.
 
template<typename... Us>
requires ( equality_comparable<tuple,tuple<Us...>> )
KUMI_TRIVIAL friend constexpr auto operator!= (tuple const &self, tuple< Us... > const &other) noexcept