3.0.0
Freundlich's C++ toolkit
Public Types | Public Member Functions
fcppt::record::object< Types > Class Template Reference

Detailed Description

template<typename Types>
class fcppt::record::object< Types >

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
TypesAn MPL sequence of fcppt::record::element.

Public Types

typedef fcppt::record::object< Types > this_type
 
typedef Types all_types
 
typedef ::brigand::as_tuple< ::brigand::transform< all_types, ::brigand::bind< fcppt::record::element_to_type, ::brigand::_1 > > > tuple
 The std::tuple type (T_1,...,T_n). More...
 

Public Member Functions

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

Member Typedef Documentation

◆ all_types

template<typename Types >
typedef Types fcppt::record::object< Types >::all_types

◆ this_type

template<typename Types >
typedef fcppt::record::object< Types > fcppt::record::object< Types >::this_type

◆ tuple

template<typename Types >
typedef ::brigand::as_tuple< ::brigand::transform< all_types, ::brigand::bind< fcppt::record::element_to_type, ::brigand::_1 > > > fcppt::record::object< Types >::tuple

The std::tuple type (T_1,...,T_n).

Constructor & Destructor Documentation

◆ object() [1/3]

template<typename Types >
fcppt::record::object< Types >::object ( )

Constructor for empty records.

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

◆ object() [2/3]

template<typename Types >
fcppt::record::object< Types >::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 Types >
template<typename ... Args, typename = fcppt::record::detail::enable_vararg_ctor< object, Args... >>
fcppt::record::object< Types >::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 Types >
template<typename Label >
fcppt::record::label_value_type< this_type, Label > const& fcppt::record::object< Types >::get ( ) const

Gets an element.

See also
fcppt::record::get.

◆ get() [2/2]

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

Gets an element.

See also
fcppt::record::get.

◆ impl()

template<typename Types >
tuple const& fcppt::record::object< Types >::impl ( ) const

◆ set() [1/2]

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

Sets an element by copy.

See also
fcppt::record::set.

◆ set() [2/2]

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

Sets an element by move.

See also
fcppt::record::set.