4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::record::object< Elements > Class Template Reference

Detailed Description

template<typename... Elements>
class fcppt::record::object< Elements >

A generic struct that identifies elements by types.

A record of an MPL sequence fcppt::record::element element<L_1,T_1>,...,element<L_n,T_n> contains an object of type T_i, accessible by L_i, for every i = 1,...,n.

Template Parameters
ElementsEach one must be of type fcppt::record::element.

Public Types

using all_types = fcppt::mpl::list::object<Elements...>
 
using this_type = fcppt::record::object<Elements...>
 
using tuple
 The fcppt::tuple::object type (T_1,...,T_n).
 

Public Member Functions

 object ()
 Constructor for empty records.
 
 object (fcppt::no_init const &)
 An uninitialized record.
 
template<typename... Args>
requires (fcppt::record::is_vararg_ctor<Args...>::value)
 object (Args &&..._args)
 Generic constructor.
 
template<typename Label >
void set (fcppt::record::label_value_type< this_type, Label > const &)
 Sets an element by copy.
 
template<typename Label >
void set (fcppt::record::label_value_type< this_type, Label > &&)
 Sets an element by move.
 
template<typename Label >
fcppt::record::label_value_type< this_type, Label > const & get () const
 Gets an element.
 
template<typename Label >
fcppt::record::label_value_type< this_type, Label > & get ()
 Gets an element.
 
tupleimpl ()
 
tuple const & impl () const
 

Member Typedef Documentation

◆ all_types

template<typename... Elements>
using fcppt::record::object< Elements >::all_types = fcppt::mpl::list::object<Elements...>

◆ this_type

template<typename... Elements>
using fcppt::record::object< Elements >::this_type = fcppt::record::object<Elements...>

◆ tuple

template<typename... Elements>
using fcppt::record::object< Elements >::tuple

Constructor & Destructor Documentation

◆ object() [1/3]

template<typename... Elements>
fcppt::record::object< Elements >::object ( )

Constructor for empty records.

Calling this if Elements is not empty, a compile-time error occurs.

◆ object() [2/3]

template<typename... Elements>
fcppt::record::object< Elements >::object ( fcppt::no_init const & )
explicit

An uninitialized record.

Calls only default constructors for its elements. Use this with care.

◆ object() [3/3]

template<typename... Elements>
template<typename... Args>
requires (fcppt::record::is_vararg_ctor<Args...>::value)
fcppt::record::object< Elements >::object ( Args &&... _args)
explicit

Generic constructor.

Initializing an element<L_i,T_i> is done by calling L_i{} = v_i where v_i is of type T_i.

The constructor checks that each L_i appears exactly once in Args.

Parameters
_argsA parameter pack, obtained by assignment to fcppt::record::label.
Template Parameters
ArgsImplementation-defined init types, obtained by assignment to fcppt::record::label.

Member Function Documentation

◆ get() [1/2]

template<typename... Elements>
template<typename Label >
fcppt::record::label_value_type< this_type, Label > & fcppt::record::object< Elements >::get ( )
nodiscard

Gets an element.

See also
fcppt::record::get.

◆ get() [2/2]

template<typename... Elements>
template<typename Label >
fcppt::record::label_value_type< this_type, Label > const & fcppt::record::object< Elements >::get ( ) const
nodiscard

Gets an element.

See also
fcppt::record::get.

◆ impl() [1/2]

template<typename... Elements>
tuple & fcppt::record::object< Elements >::impl ( )
nodiscard

◆ impl() [2/2]

template<typename... Elements>
tuple const & fcppt::record::object< Elements >::impl ( ) const
nodiscard

◆ set() [1/2]

template<typename... Elements>
template<typename Label >
void fcppt::record::object< Elements >::set ( fcppt::record::label_value_type< this_type, Label > && )

Sets an element by move.

See also
fcppt::record::set.

◆ set() [2/2]

template<typename... Elements>
template<typename Label >
void fcppt::record::object< Elements >::set ( fcppt::record::label_value_type< this_type, Label > const & )

Sets an element by copy.

See also
fcppt::record::set.