tuples  0.1
 All Classes Namespaces Files Functions Typedefs Friends Macros
Classes | Public Member Functions | Friends | List of all members
tuples::tagged_tuple< Tags > Class Template Reference

A compile time associative container between structs and data. More...

#include <tagged_tuple.hpp>

Public Member Functions

template<bool Dummy = true, typename std::enable_if< args_constructor< Dummy >::enable_default()>::type * = nullptr>
constexpr tagged_tuple () noexcept(tuples_detail::all< std::is_nothrow_default_constructible< tag_type< Tags >>::value...>::value)
 
constexpr tagged_tuple (tagged_tuple const &)=default
 
constexpr tagged_tuple (tagged_tuple &&)=default
 
template<bool Dummy = true, typename std::enable_if< args_constructor< Dummy >::template enable_explicit< tag_type< Tags > const &...>()>::type * = nullptr>
constexpr tagged_tuple (tag_type< Tags > const &...ts) noexcept(tuples_detail::all< std::is_nothrow_copy_constructible< tuples_detail::tagged_tuple_leaf< Tags >>::value...>::value)
 
template<bool Dummy = true, typename std::enable_if< args_constructor< Dummy >::template enable_implicit< tag_type< Tags > const &...>()>::type * = nullptr>
constexpr tagged_tuple (tag_type< Tags > const &...ts) noexcept(tuples_detail::all< std::is_nothrow_copy_constructible< tuples_detail::tagged_tuple_leaf< Tags >>::value...>::value)
 
template<class... Us, typename std::enable_if< args_constructor< not pack_is_tagged_tuple< Us...>::value andsizeof...(Us)==sizeof...(Tags)>::template enable_explicit< Us &&...>()>::type * = nullptr>
constexpr tagged_tuple (Us &&...us) noexcept(tuples_detail::all< std::is_nothrow_constructible< tuples_detail::tagged_tuple_leaf< Tags >, Us && >::value...>::value)
 
template<class... Us, typename std::enable_if< args_constructor< not pack_is_tagged_tuple< Us...>::value andsizeof...(Us)==sizeof...(Tags)>::template enable_implicit< Us &&...>()>::type * = nullptr>
constexpr tagged_tuple (Us &&...us) noexcept(tuples_detail::all< std::is_nothrow_constructible< tuples_detail::tagged_tuple_leaf< Tags >, Us && >::value...>::value)
 
template<class... UTags, typename std::enable_if< tuple_like_constructor< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_constructible< tag_type< Tags >, tag_type< UTags > const & >::value...>::value >::template enable_explicit< tagged_tuple< UTags...> const &, tag_type< UTags >...>()>::type * = nullptr>
constexpr tagged_tuple (tagged_tuple< UTags...> const &t) noexcept(tuples_detail::all< std::is_nothrow_constructible< tag_type< Tags >, tag_type< UTags > const & >::value...>::value)
 
template<class... UTags, typename std::enable_if< tuple_like_constructor< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_constructible< tag_type< Tags >, tag_type< UTags > const & >::value...>::value >::template enable_implicit< tagged_tuple< UTags...> const &, tag_type< UTags >...>()>::type * = nullptr>
constexpr tagged_tuple (tagged_tuple< UTags...> const &t) noexcept(tuples_detail::all< std::is_nothrow_constructible< tag_type< Tags >, tag_type< UTags > const & >::value...>::value)
 
template<class... UTags, typename std::enable_if< tuple_like_constructor< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_constructible< tag_type< Tags >, tag_type< UTags > && >::value...>::value >::template enable_explicit< tagged_tuple< UTags...> &&, tag_type< UTags >...>()>::type * = nullptr>
constexpr tagged_tuple (tagged_tuple< UTags...> &&t) noexcept(tuples_detail::all< std::is_nothrow_constructible< tag_type< Tags >, tag_type< UTags > && >::value...>::value)
 
template<class... UTags, typename std::enable_if< tuple_like_constructor< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_constructible< tag_type< Tags >, tag_type< UTags > && >::value...>::value >::template enable_implicit< tagged_tuple< UTags...> &&, tag_type< UTags >...>()>::type * = nullptr>
constexpr tagged_tuple (tagged_tuple< UTags...> &&t) noexcept(tuples_detail::all< std::is_nothrow_constructible< tag_type< Tags >, tag_type< UTags > && >::value...>::value)
 
tagged_tuple & operator= (typename std::conditional< is_copy_assignable::value, tagged_tuple, tuples_detail::no_such_type >::type const &t) noexcept(is_nothrow_copy_assignable::value)
 
tagged_tuple & operator= (typename std::conditional< is_move_assignable::value, tagged_tuple, tuples_detail::no_such_type >::type &&t) noexcept(is_nothrow_move_assignable::value)
 
template<class... UTags, typename std::enable_if< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_assignable< tag_type< Tags > &, tag_type< UTags > const & >::value...>::value >::type * = nullptr>
tagged_tuple & operator= (tagged_tuple< UTags...> const &t) noexcept(tuples_detail::all< std::is_nothrow_assignable< tag_type< Tags > &, tag_type< UTags > const & >::value...>::value)
 
template<class... UTags, typename std::enable_if< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_assignable< tag_type< Tags > &, tag_type< UTags > && >::value...>::value >::type * = nullptr>
tagged_tuple & operator= (tagged_tuple< UTags...> &&t) noexcept(tuples_detail::all< std::is_nothrow_assignable< tag_type< Tags > &, tag_type< UTags > && >::value...>::value)
 
void swap (tagged_tuple &t) noexcept(tuples_detail::all< tuples_detail::is_nothrow_swappable_with< tuples_detail::tagged_tuple_leaf< Tags >, tuples_detail::tagged_tuple_leaf< Tags >>::value...>::value)
 

Friends

template<class Tag , class... LTags>
constexpr const Tag::type & get (const tagged_tuple< LTags...> &t) noexcept
 
template<class Tag , class... LTags>
constexpr Tag::type & get (tagged_tuple< LTags...> &t) noexcept
 
template<class Tag , class... LTags>
constexpr const Tag::type && get (const tagged_tuple< LTags...> &&t) noexcept
 
template<class Tag , class... LTags>
constexpr Tag::type && get (tagged_tuple< LTags...> &&t) noexcept
 

Detailed Description

template<class... Tags>
class tuples::tagged_tuple< Tags >

A compile time associative container between structs and data.

The template parameters to tagged_tuple are structs with a member type alias, type denoting the type of the data to be associated with the tag. An example tag is:

struct Int {
using type = int;
};

A tagged_tuple is created by, for example

Elements are retrieved using the get functions as follows:

CHECK(tuples::get<tags::Int>(t0) == 2);
CHECK(tuples::get<tags::Short0>(t0) == 9);

Constructor & Destructor Documentation

template<class... Tags>
template<bool Dummy = true, typename std::enable_if< args_constructor< Dummy >::enable_default()>::type * = nullptr>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( )
inlinenoexcept
template<class... Tags>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( tagged_tuple< Tags > const &  )
default
template<class... Tags>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( tagged_tuple< Tags > &&  )
default
template<class... Tags>
template<bool Dummy = true, typename std::enable_if< args_constructor< Dummy >::template enable_explicit< tag_type< Tags > const &...>()>::type * = nullptr>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( tag_type< Tags > const &...  ts)
inlineexplicitnoexcept
template<class... Tags>
template<bool Dummy = true, typename std::enable_if< args_constructor< Dummy >::template enable_implicit< tag_type< Tags > const &...>()>::type * = nullptr>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( tag_type< Tags > const &...  ts)
inlinenoexcept
template<class... Tags>
template<class... Us, typename std::enable_if< args_constructor< not pack_is_tagged_tuple< Us...>::value andsizeof...(Us)==sizeof...(Tags)>::template enable_explicit< Us &&...>()>::type * = nullptr>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( Us &&...  us)
inlineexplicitnoexcept
template<class... Tags>
template<class... Us, typename std::enable_if< args_constructor< not pack_is_tagged_tuple< Us...>::value andsizeof...(Us)==sizeof...(Tags)>::template enable_implicit< Us &&...>()>::type * = nullptr>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( Us &&...  us)
inlinenoexcept
template<class... Tags>
template<class... UTags, typename std::enable_if< tuple_like_constructor< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_constructible< tag_type< Tags >, tag_type< UTags > const & >::value...>::value >::template enable_explicit< tagged_tuple< UTags...> const &, tag_type< UTags >...>()>::type * = nullptr>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( tagged_tuple< UTags...> const &  t)
inlineexplicitnoexcept
template<class... Tags>
template<class... UTags, typename std::enable_if< tuple_like_constructor< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_constructible< tag_type< Tags >, tag_type< UTags > const & >::value...>::value >::template enable_implicit< tagged_tuple< UTags...> const &, tag_type< UTags >...>()>::type * = nullptr>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( tagged_tuple< UTags...> const &  t)
inlinenoexcept
template<class... Tags>
template<class... UTags, typename std::enable_if< tuple_like_constructor< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_constructible< tag_type< Tags >, tag_type< UTags > && >::value...>::value >::template enable_explicit< tagged_tuple< UTags...> &&, tag_type< UTags >...>()>::type * = nullptr>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( tagged_tuple< UTags...> &&  t)
inlineexplicitnoexcept
template<class... Tags>
template<class... UTags, typename std::enable_if< tuple_like_constructor< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_constructible< tag_type< Tags >, tag_type< UTags > && >::value...>::value >::template enable_implicit< tagged_tuple< UTags...> &&, tag_type< UTags >...>()>::type * = nullptr>
constexpr tuples::tagged_tuple< Tags >::tagged_tuple ( tagged_tuple< UTags...> &&  t)
inlinenoexcept

Member Function Documentation

template<class... Tags>
tagged_tuple& tuples::tagged_tuple< Tags >::operator= ( typename std::conditional< is_copy_assignable::value, tagged_tuple< Tags >, tuples_detail::no_such_type >::type const &  t)
inlinenoexcept
template<class... Tags>
tagged_tuple& tuples::tagged_tuple< Tags >::operator= ( typename std::conditional< is_move_assignable::value, tagged_tuple< Tags >, tuples_detail::no_such_type >::type &&  t)
inlinenoexcept
template<class... Tags>
template<class... UTags, typename std::enable_if< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_assignable< tag_type< Tags > &, tag_type< UTags > const & >::value...>::value >::type * = nullptr>
tagged_tuple& tuples::tagged_tuple< Tags >::operator= ( tagged_tuple< UTags...> const &  t)
inlinenoexcept
template<class... Tags>
template<class... UTags, typename std::enable_if< sizeof...(Tags)==sizeof...(UTags) andtuples_detail::all< std::is_assignable< tag_type< Tags > &, tag_type< UTags > && >::value...>::value >::type * = nullptr>
tagged_tuple& tuples::tagged_tuple< Tags >::operator= ( tagged_tuple< UTags...> &&  t)
inlinenoexcept
template<class... Tags>
void tuples::tagged_tuple< Tags >::swap ( tagged_tuple< Tags > &  t)
inlinenoexcept

References tuples::swap().

Friends And Related Function Documentation

template<class... Tags>
template<class Tag , class... LTags>
constexpr const Tag::type& get ( const tagged_tuple< LTags...> &  t)
friend
template<class... Tags>
template<class Tag , class... LTags>
constexpr Tag::type& get ( tagged_tuple< LTags...> &  t)
friend
template<class... Tags>
template<class Tag , class... LTags>
constexpr const Tag::type&& get ( const tagged_tuple< LTags...> &&  t)
friend
template<class... Tags>
template<class Tag , class... LTags>
constexpr Tag::type&& get ( tagged_tuple< LTags...> &&  t)
friend

The documentation for this class was generated from the following file: