4.4.1
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
fcppt::record Namespace Reference

Classes

struct  element
 An element of a record. More...
 
class  element_init
 The type produced by initializing a single record element. More...
 
struct  is_element
 Tests if a type is an fcppt::record::element. More...
 
struct  is_element< fcppt::record::element< Type, Tag > >
 
struct  is_label
 Tests if a type is an fcppt::record::label. More...
 
struct  is_label< fcppt::record::label< Tag > >
 
struct  is_object
 Tests if a type is an fcppt::record::object. More...
 
struct  is_object< fcppt::record::object< Elements... > >
 
struct  label
 A type identifying an element of a record. More...
 
class  object
 A generic struct that identifies elements by types. More...
 

Typedefs

template<fcppt::mpl::list::object_concept Records>
using all_disjoint = std::is_same< fcppt::mpl::set::size< fcppt::mpl::list::fold< Records, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::set::union_ >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::record::label_set >, fcppt::mpl::arg< 1 > >, fcppt::mpl::arg< 2 > >, fcppt::mpl::set::object<> > >, fcppt::mpl::list::size< fcppt::mpl::list::join< fcppt::mpl::list::map< Records, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::set::to_list >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::record::label_set >, fcppt::mpl::arg< 1 > > > > > > >
 Tests if multiple records have disjoint label sets.
 
template<typename RecordL , typename RecordR >
using are_disjoint = std::is_same< fcppt::mpl::set::intersection< fcppt::record::label_set< RecordL >, fcppt::record::label_set< RecordR > >, fcppt::mpl::set::object<> >
 Tests if two records have disjoint label sets.
 
template<typename Record1 , typename Record2 >
using are_equivalent = fcppt::mpl::map::equal< fcppt::record::element_map< Record1 >, fcppt::record::element_map< Record2 > >
 Tests if two records have the same element maps.
 
template<typename RecordL , typename RecordR >
using disjoint_product = typename fcppt::record::detail::disjoint_product< RecordL, RecordR >::type
 The product of two disjoint records.
 
template<typename Type >
using element_init_tag = typename fcppt::record::detail::element_init_tag< Type >::type
 The tag type of fcppt::record::element_init.
 
template<typename Type >
using element_init_type = typename fcppt::record::detail::element_init_type< Type >::type
 The value type of fcppt::record::element_init.
 
template<typename Record >
using element_map = fcppt::mpl::list::fold< fcppt::record::element_vector< Record >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::map::insert >, fcppt::mpl::arg< 2 >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::record::element_to_label >, fcppt::mpl::arg< 1 > >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::record::element_to_type >, fcppt::mpl::arg< 1 > > >, fcppt::mpl::map::object<> >
 A metafunction computing the element map of a record.
 
template<typename Record >
using element_tag_tuple = fcppt::mpl::list::as_tuple< fcppt::mpl::list::map< fcppt::record::element_vector< Record >, fcppt::mpl::lambda< fcppt::tag > > >
 A metafunction returning the elements of record as a fcppt::tuple::object of fcppt::tag types.
 
template<typename Element >
using element_to_label = typename fcppt::record::detail::element_to_label< Element >::type
 Extracts the type of an fcppt::record::element.
 
template<typename Element >
using element_to_type = typename fcppt::record::detail::element_to_type< std::remove_cv_t< Element > >::type
 Extracts the label of an element.
 
template<typename Record >
using element_vector = typename fcppt::record::detail::element_vector< Record >::type
 A metafunction returning the elements of record as an MPL vector.
 
template<typename... Args>
using enable_vararg_ctor = std::enable_if_t< std::conjunction_v< fcppt::record::detail::is_element_init< std::remove_cvref_t< Args > >... > >
 Checks if a parameter pack is suitable for record initialization.
 
template<fcppt::mpl::list::object_concept List>
using from_list = fcppt::mpl::list::as< fcppt::record::object, List >
 Declares a record using an mpl::list.
 
template<typename Record , typename Label >
using has_label = fcppt::mpl::set::contains< fcppt::record::label_set< Record >, Label >
 Tests if a record has an fcppt::record::label.
 
template<typename Record >
using label_set = fcppt::mpl::set::from_list_relaxed< fcppt::record::detail::label_list< fcppt::record::element_vector< Record > > >
 The set of labels of a record.
 
template<typename Record , typename Label >
using label_value_type = fcppt::record::element_to_type< fcppt::record::detail::find_element< fcppt::record::element_vector< Record >, Label > >
 Metafunction that computes the value type of a label inside a record.
 
template<typename Record , typename Function >
using map_elements = fcppt::record::from_list< fcppt::mpl::list::map< fcppt::record::element_vector< Record >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::record::element >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::record::element_to_label >, fcppt::mpl::arg< 1 > >, Function > > >
 Maps the elements of a vector using a metafunction.
 
template<typename Record , typename Function >
using map_result = fcppt::record::map_elements< Record, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::record::detail::map_result >, fcppt::mpl::constant< Function >, fcppt::mpl::arg< 1 > > >
 The result of mapping a record.
 

Functions

template<typename... Types1, typename... Types2>
bool operator== (fcppt::record::object< Types1... > const &_record1, fcppt::record::object< Types2... > const &_record2)
 Compares two records for equality.
 
template<typename... Types1, typename... Types2>
bool operator!= (fcppt::record::object< Types1... > const &_record1, fcppt::record::object< Types2... > const &_record2)
 Compares two records for inequality.
 
template<typename Label , typename... Elements>
fcppt::record::label_value_type< fcppt::record::object< Elements... >, Label > constget (fcppt::record::object< Elements... > const &_arg)
 Gets an element from a record.
 
template<typename Label , typename... Elements>
fcppt::record::label_value_type< fcppt::record::object< Elements... >, Label > & get (fcppt::record::object< Elements... > &_arg)
 Gets an element from a record.
 
template<typename Result , typename Function >
Result init (Function const &_function)
 Initializes a record using a function.
 
template<typename Label >
std::string label_name ()
 Returns the name of a label as a string.
 
template<typename... Args, typename = fcppt::record::enable_vararg_ctor<Args...>>
requires (fcppt::mpl::list::distinct< fcppt::mpl::list::object<fcppt::record::label<fcppt::record::element_init_tag<Args>>...>>::value)
fcppt::record::object< fcppt::record::element< fcppt::record::label< fcppt::record::element_init_tag< Args > >, fcppt::record::element_init_type< Args > >... > make (Args &&..._args)
 Creates a record from an initializer list.
 
template<typename Record , typename Function >
fcppt::record::map_result< Record, Functionmap (Record &&_record, Function const &_function)
 Maps a record using a function.
 
template<typename Record1 , typename Record2 >
fcppt::record::disjoint_product< std::remove_cvref_t< Record1 >, std::remove_cvref_t< Record2 > > multiply_disjoint (Record1 &&_record1, Record2 &&_record2)
 Creates the disjoint product of two records.
 
template<typename Ch , typename Traits , typename... Elements>
std::basic_ostream< Ch, Traits > & operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::record::object< Elements... > const &_record)
 Outputs a record to a stream.
 
template<typename Result , typename Arg >
Result permute (Arg &&_arg)
 Permutes one record into another.
 
template<typename Label , typename... Elements>
void set (fcppt::record::object< Elements... > &_arg, fcppt::record::label_value_type< fcppt::record::object< Elements... >, Label > const &_value)
 Sets an element in a record by copy.
 
template<typename Label , typename... Elements>
void set (fcppt::record::object< Elements... > &_arg, fcppt::record::label_value_type< fcppt::record::object< Elements... >, Label > &&_value)
 Sets an element in a record by move.
 

Variables

template<fcppt::mpl::list::object_concept Records>
constexpr bool all_disjoint_v = fcppt::record::all_disjoint<Records>::value
 Tests if multiple records have disjoint label sets.
 
template<typename RecordL , typename RecordR >
constexpr bool are_disjoint_v = fcppt::record::are_disjoint<RecordL, RecordR>::value
 Tests if two records have disjoint label sets.
 
template<typename Record1 , typename Record2 >
constexpr bool are_equivalent_v = fcppt::record::are_equivalent<Record1, Record2>::value
 Tests if two records have the same element maps.