Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
aggregate.hpp File Reference

Classes

class  mundy::tagged< Tag, T >
 A small helper type for tying a Tag to an underlying value. More...
struct  mundy::has_tag_type< T, typename >
 Check if a type defines an alias named tag_type. More...
struct  mundy::has_tag_type< T, std::void_t< typename T::tag_type > >
struct  mundy::all_have_tags< Ts >
 Check if all types in a pack define an alias named tag_type. More...
struct  mundy::all_tags_unique< Ts >
 Check if all tag_type values in a tagged value pack are unique. More...
struct  mundy::contains_tag< Tag, Ts >
 Check if a tagged value pack contains a value with the given Tag. More...
struct  mundy::contains_tag< Tag, First, Rest... >
struct  mundy::index_of_tag< Tag, Ts >
 Find the index of Tag inside a pack of tagged components. More...
class  mundy::runtime_aggregate< VariantType >
 A runtime_aggregate: A bag of runtime tagged variants or, In other words, an unordered map of variants indexed by tag string. More...
class  mundy::variant_aggregate< VariantType, Tags >
 A variant_aggregate: A bag of compile-time tagged variants. In other words, a compile-time map of variants indexed by tag type. More...
struct  mundy::variant_aggregate_tag< I, variant_aggregate< VariantType, Tags... > >
struct  mundy::variant_aggregate_has< Tag, VarAggType >
 Check whether a variant_aggregate type has a value with the given Tag. Usage: variant_aggregate_has_v<Tag, VarAggType>. More...
class  mundy::aggregate< TaggedComponents >
 An aggregate: A bag of compile-time tagged types In other words, a compile-time unordered map of arbitrary types indexed by tag type. More...
struct  mundy::aggregate_has< Tag, AggType >
 Check if an aggregate type has a value with the given Tag usage aggregate_has_v<Tag, AggType>. More...
struct  mundy::aggregate_tag< I, aggregate< Ts... > >

Namespaces

namespace  mundy

Functions

template<typename Tag, typename T>
constexpr auto mundy::apply_tag (T &&value)
 Helper function to attach a tag to a type.

Variables

template<typename T>
static constexpr bool mundy::has_tag_type_v = has_tag_type<T>::value
template<typename... Ts>
static constexpr bool mundy::all_have_tags_v = all_have_tags<Ts...>::value
template<typename... Ts>
static constexpr bool mundy::all_tags_unique_v = all_tags_unique<Ts...>::value
template<typename Tag, typename... Ts>
static constexpr bool mundy::contains_tag_v = contains_tag<Tag, Ts...>::value
template<typename Tag, typename... Ts>
static constexpr size_t mundy::index_of_tag_v = index_of_tag<Tag, Ts...>::value

Non-member functions

template<size_t I, typename VarAggType>
using mundy::variant_aggregate_tag_t = variant_aggregate_tag<I, VarAggType>::type
template<typename Tag, typename VarAggType>
static constexpr bool mundy::variant_aggregate_has_v = variant_aggregate_has<Tag, VarAggType>::value
template<typename VariantType>
auto mundy::make_runtime_aggregate ()
 Canonical way to construct a runtime_aggregate.
template<typename VariantType>
constexpr auto mundy::make_variant_aggregate ()
 Canonical way to construct a variant_aggregate.
template<typename Tag, typename VariantType, typename... Tags>
constexpr const VariantType & mundy::get (const variant_aggregate< VariantType, Tags... > &v_agg)
 Fetch the variant corresponding to the given Tag.
template<typename Tag, typename VariantType, typename... Tags>
constexpr VariantType & mundy::get (variant_aggregate< VariantType, Tags... > &v_agg)
 Fetch the variant corresponding to the given Tag.
template<size_t I, typename VariantType, typename... Tags>
constexpr const VariantType & mundy::get (const variant_aggregate< VariantType, Tags... > &v_agg)
 Fetch the variant at index I.
template<size_t I, typename VariantType, typename... Tags>
constexpr VariantType & mundy::get (variant_aggregate< VariantType, Tags... > &v_agg)
template<typename Tag, typename VariantType, typename... Tags>
constexpr bool mundy::has (const variant_aggregate< VariantType, Tags... > &)
 Check if a variant_aggregate has a variant with the given Tag.
template<typename... SelectedTags, typename VariantType, typename... Tags>
constexpr auto mundy::project (variant_aggregate< VariantType, Tags... > &v_agg)
 Project selected tags from a variant_aggregate into a new variant_aggregate. Copies the corresponding variants and preserves the requested tag order.
template<typename... SelectedTags, typename VariantType, typename... Tags>
constexpr auto mundy::project (const variant_aggregate< VariantType, Tags... > &v_agg)
 Project selected tags from a const variant_aggregate into a new variant_aggregate. Copies the corresponding variants and preserves the requested tag order.

Non-member functions/helpers

template<size_t I, typename AggType>
using mundy::aggregate_tag_t = aggregate_tag<I, AggType>::type
template<typename Tag, typename AggType>
static constexpr bool mundy::aggregate_has_v = aggregate_has<Tag, AggType>::value
template<typename... Tags, typename... Ts>
constexpr auto mundy::project (aggregate< Ts... > &agg)
 Project selected tags from an aggregate into a new aggregate (copies their corresponding components).
template<typename... Tags, typename... Ts>
constexpr auto mundy::project (const aggregate< Ts... > &agg)
 Project selected tags from a const aggregate into a new aggregate (copies their corresponding components).
template<typename Tag, typename... Ts>
constexpr const auto & mundy::get (const aggregate< Ts... > &agg)
 Fetch the value corresponding to the given Tag.
template<typename Tag, typename... Ts>
constexpr auto & mundy::get (aggregate< Ts... > &agg)
 Fetch the value corresponding to the given Tag.
template<size_t I, typename... Ts>
constexpr const auto & mundy::get (const aggregate< Ts... > &agg)
 Fetch the value at index I.
template<size_t I, typename... Ts>
constexpr auto & mundy::get (aggregate< Ts... > &agg)
template<typename Tag, typename... Ts>
constexpr bool mundy::has (const aggregate< Ts... > &)
 Check if an aggregate have a value with the given Tag.
template<typename... Ts>
std::ostream & mundy::operator<< (std::ostream &os, const aggregate< Ts... > &agg)
 Overload the stream operator for aggregates.