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

Fixed-size collection of heterogeneous fields necessarily named, names are unique. More...

#include <kumi/product_types/record.hpp>

Detailed Description

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

Fixed-size collection of heterogeneous fields necessarily named, names are unique.

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

kumi::record is also compatible with standard tuple operations and structured bindings to some extent.

Template Parameters
TsSequence of fields stored inside kumi::record.

Public Member Functions

template<typename... Us>
constexpr recordoperator= (record< 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 recordoperator= (record< Us... > const &other)
 Replaces the contents of the record with the contents of another record.
Accessors
template<std::size_t I>
constexpr decltype(auto) operator[] (index_t< I >) &noexcept
 Extracts the Ith field from a kumi::record.
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 of the field labeled Name from a kumi::record.
template<concepts::identifier Name>
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.

(Note that these are not member symbols.)

template<typename CharT, typename Traits>
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &os, record const &t) noexcept
 Inserts a kumi::record in an output stream.
template<concepts::identifier auto... Fields, typename... Ts>
constexpr auto forward_as_record (Ts &&... ts) -> record< field< decltype(Fields), Ts && >... >
 Creates a kumi::record of forwarding references to its arguments.
template<typename... Ts>
constexpr auto make_record (Ts &&... ts) -> record< std::unwrap_ref_decay_t< Ts >... >
 Creates a record object, deducing the target type from the types of arguments.
template<concepts::record_type R>
constexpr auto to_ref (R &&r)
 Creates a kumi::record of references given a reference to a kumi::record_type.
template<concepts::record_type Type, typename... 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<concepts::record_type Type>
constexpr auto to_record (Type &&r)
 Converts a kumi::record_type to an instance kumi::record.
template<std::size_t I, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &r) noexcept
 Extracts the Ith field from a kumi::record.
template<str Name, typename... Ts>
decltype(auto) constexpr get (record< Ts... > &r) noexcept
 Extracts the element of the field labeled Name from a kumi::record if it exists.
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.

Properties

constexpr auto values () noexcept
 Returns references to the values of the element in a kumi::record.
constexpr auto values () const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static constexpr auto size () noexcept
 Returns the number of elements in a kumi::record.
static constexpr bool empty () noexcept
 Returns true if a kumi::record contains 0 elements.
static constexpr auto names () noexcept
 Returns the names of the elements in a kumi::record.

Comparison operators

template<typename... Us>
requires (concepts::named_equality_comparable<record, record<Us...>>)
constexpr auto operator== (record const &self, record< Us... > const &other) noexcept
 Compares a record with an other for equality.