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

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

#include <kumi/product_types/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... 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>
constexpr tupleoperator= (tuple< Us... > const &other)
 Replaces the contents of the tuple with the contents of another tuple.
Accessors
template<std::size_t I>
constexpr decltype(auto) operator[] (index_t< I > i) &noexcept
 Extracts the Ith element from a kumi::tuple.
template<std::size_t I>
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>
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>
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<typename T>
constexpr decltype(auto) operator[] (as< T >) &noexcept
 Extracts the Ith element from a kumi::tuple.
template<typename T>
constexpr decltype(auto) operator[] (as< T >) &&noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T>
constexpr decltype(auto) operator[] (as< T >) 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<typename T>
constexpr decltype(auto) operator[] (as< T >) 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<concepts::identifier Name>
constexpr decltype(auto) operator[] (Name const &) &noexcept
 Extracts the element labeled Name from a kumi::tuple.
template<concepts::identifier Name>
requires (concepts::uniquely_named<Ts...> && concepts::contains_field<Name, Ts...>)
constexpr decltype(auto) operator[] (Name 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<concepts::identifier Name>
constexpr decltype(auto) operator[] (Name const &) 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<concepts::identifier Name>
constexpr decltype(auto) operator[] (Name const &) 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>
constexpr auto cast () const
 Converts a tuple<Ts...> to a tuple<Us...>.
template<typename... Us>
 explicit (!_::piecewise_convertible< tuple< Ts const &... >, tuple< Us... > >) const expr operator tuple< Us... >() const
 Enables static casting a tuple<Ts...> to a tuple<Us...>.
template<typename... Us>
 explicit (!_::piecewise_convertible< tuple< Ts &... >, tuple< Us... > >) const expr operator tuple< Us... >()
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Static Public Member Functions

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

(Note that these are not member symbols.)

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.
template<typename... Ts>
constexpr auto forward_as_tuple (Ts &&... ts) -> tuple< Ts &&... >
 Creates a kumi::tuple of forwarding references to its arguments.
template<concepts::product_type T>
constexpr auto to_ref (T &&t)
 Creates a kumi::tuple of references given a reference to a kumi::product_type.
template<typename Type, typename... Ts>
constexpr auto from_tuple (tuple< Ts... > const &t)
 Converts a kumi::tuple to an instance of an arbitrary type.
template<concepts::product_type T>
constexpr auto to_tuple (T &&t)
 Converts a kumi::product_type to an instance kumi::tuple.
template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &t) noexcept
 Extracts the Ith element from a kumi::tuple.
template<str S, typename... Ts>
decltype(auto) constexpr get (tuple< Ts... > &t) noexcept
 Extracts the field labeled S from a kumi::tuple if it exists.
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.

Comparison operators

template<typename... Us>
requires (concepts::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; }
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; }
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; }
constexpr auto operator>= (tuple const &lhs, tuple< Us... > const &rhs) noexcept
 Compares tuples for lexicographical is greater relation relation.