SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
tuples Namespace Reference

Contains utilities for working with tuples. More...

Classes

class  TaggedTuple
 An associative container that is indexed by structs. More...
class  TaggedTuple<>
struct  tuple_size
struct  tuple_size< const TaggedTuple< Tags... > >
struct  tuple_size< const volatile TaggedTuple< Tags... > >
struct  tuple_size< TaggedTuple< Tags... > >
struct  tuple_size< volatile TaggedTuple< Tags... > >

Typedefs

template<class Tag>
using tag_type = typename Tag::type
 Returns the type of the Tag.
template<typename T>
using tagged_tuple_from_typelist

Functions

template<size_t I, class... Tags>
constexpr tmpl::at_c< tmpl::list< Tags... >, I >::type && get (TaggedTuple< Tags... > &&t)
template<size_t I, class... Tags>
constexpr const tmpl::at_c< tmpl::list< Tags... >, I >::type & get (const TaggedTuple< Tags... > &t)
template<size_t I, class... Tags>
constexpr tmpl::at_c< tmpl::list< Tags... >, I >::type & get (TaggedTuple< Tags... > &t)
template<class... LTags, class... RTags, typename std::enable_if< sizeof...(LTags)==sizeof...(RTags)>::type * = nullptr>
TUPLES_LIB_CONSTEXPR_CXX_14 bool operator== (TaggedTuple< LTags... > const &lhs, TaggedTuple< RTags... > const &rhs)
template<class... LTags, class... RTags, typename std::enable_if< sizeof...(LTags)==sizeof...(RTags)>::type * = nullptr>
TUPLES_LIB_CONSTEXPR_CXX_14 bool operator!= (TaggedTuple< LTags... > const &lhs, TaggedTuple< RTags... > const &rhs)
template<class... LTags, class... RTags, typename std::enable_if< sizeof...(LTags)==sizeof...(RTags)>::type * = nullptr>
TUPLES_LIB_CONSTEXPR_CXX_14 bool operator< (TaggedTuple< LTags... > const &lhs, TaggedTuple< RTags... > const &rhs)
template<class... LTags, class... RTags, typename std::enable_if< sizeof...(LTags)==sizeof...(RTags)>::type * = nullptr>
TUPLES_LIB_CONSTEXPR_CXX_14 bool operator> (TaggedTuple< LTags... > const &lhs, TaggedTuple< RTags... > const &rhs)
template<class... LTags, class... RTags, typename std::enable_if< sizeof...(LTags)==sizeof...(RTags)>::type * = nullptr>
TUPLES_LIB_CONSTEXPR_CXX_14 bool operator<= (TaggedTuple< LTags... > const &lhs, TaggedTuple< RTags... > const &rhs)
template<class... LTags, class... RTags, typename std::enable_if< sizeof...(LTags)==sizeof...(RTags)>::type * = nullptr>
TUPLES_LIB_CONSTEXPR_CXX_14 bool operator>= (TaggedTuple< LTags... > const &lhs, TaggedTuple< RTags... > const &rhs)
template<class... Tags, typename std::enable_if< tuples_detail::all< tuples_detail::is_swappable_with< tuples_detail::TaggedTupleLeaf< Tags >, tuples_detail::TaggedTupleLeaf< Tags > >::value... >::value >::type * = nullptr>
void swap (TaggedTuple< Tags... > &lhs, TaggedTuple< Tags... > &rhs)
template<typename ReturnedTaggedTuple, typename... Tags>
ReturnedTaggedTuple reorder (TaggedTuple< Tags... > input)
 Given an input TaggedTuple, produce an output TaggedTuple with the tags in a different order. All tags must be the same except for ordering.
template<class... Tags>
std::ostreamoperator<< (std::ostream &os, const TaggedTuple< Tags... > &t)
template<class Tag, class... Tags>
constexpr const Tag::type & get (const TaggedTuple< Tags... > &t)
 Retrieve the element of Tag in the TaggedTuple.
template<class Tag, class... Tags>
constexpr Tag::type & get (TaggedTuple< Tags... > &t)
 Retrieve the element of Tag in the TaggedTuple.
template<class Tag, class... Tags>
constexpr const Tag::type && get (const TaggedTuple< Tags... > &&t)
 Retrieve the element of Tag in the TaggedTuple.
template<class Tag, class... Tags>
constexpr Tag::type && get (TaggedTuple< Tags... > &&t)
 Retrieve the element of Tag in the TaggedTuple.
template<typename ApplyTags, typename F, typename... Tags>
constexpr decltype(auto) apply (F &&f, const TaggedTuple< Tags... > &t)
 Invoke f with the ApplyTags taken from t expanded in a parameter pack.
template<typename F, typename... Tags>
constexpr decltype(auto) apply (F &&f, const TaggedTuple< Tags... > &t)
 Invoke f with the ApplyTags taken from t expanded in a parameter pack.
template<typename... Tags1, typename... Tags2>
tuples::TaggedTuple< Tags1..., Tags2... > tagged_tuple_cat (const tuples::TaggedTuple< Tags1... > &tuple1, const tuples::TaggedTuple< Tags2... > &tuple2)
template<typename... Tags1, typename... Tags2>
tuples::TaggedTuple< Tags1..., Tags2... > tagged_tuple_cat (tuples::TaggedTuple< Tags1... > &&tuple1, tuples::TaggedTuple< Tags2... > &&tuple2)

Detailed Description

Contains utilities for working with tuples.

Function Documentation

◆ reorder()

template<typename ReturnedTaggedTuple, typename... Tags>
ReturnedTaggedTuple tuples::reorder ( TaggedTuple< Tags... > input)

Given an input TaggedTuple, produce an output TaggedTuple with the tags in a different order. All tags must be the same except for ordering.

Example

const auto test4 = tuples::reorder<
tuples::TaggedTuple<email, not_streamable_tag, parents, age, name>>(
std::move(test));

◆ tagged_tuple_cat() [1/2]

template<typename... Tags1, typename... Tags2>
tuples::TaggedTuple< Tags1..., Tags2... > tuples::tagged_tuple_cat ( const tuples::TaggedTuple< Tags1... > & tuple1,
const tuples::TaggedTuple< Tags2... > & tuple2 )

Constructs a TaggedTuple that is a concatenation of two TaggedTuples.

Example

const tuples::TaggedTuple<name, age> test5("Eamonn", 17);
const tuples::TaggedTuple<email, parents, not_streamable_tag> test6(
"bla@bla.bla", std::vector<std::string>{"Mom", "Dad"}, 0);
const auto test7 = tuples::tagged_tuple_cat(test5, test6);

◆ tagged_tuple_cat() [2/2]

template<typename... Tags1, typename... Tags2>
tuples::TaggedTuple< Tags1..., Tags2... > tuples::tagged_tuple_cat ( tuples::TaggedTuple< Tags1... > && tuple1,
tuples::TaggedTuple< Tags2... > && tuple2 )

Constructs a TaggedTuple that is a concatenation of two TaggedTuples.

Example

const tuples::TaggedTuple<name, age> test5("Eamonn", 17);
const tuples::TaggedTuple<email, parents, not_streamable_tag> test6(
"bla@bla.bla", std::vector<std::string>{"Mom", "Dad"}, 0);
const auto test7 = tuples::tagged_tuple_cat(test5, test6);