Wildmeshing Toolkit
DerivedReferenceWrapperVariantTraits.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <tuple>
3
4
#include "
ReferenceWrapperVariant.hpp
"
5
#include "
tuple/as_variant_type.hpp
"
6
#include "
tuple/concatenate_types.hpp
"
7
namespace
wmtk::utils::metaprogramming
{
8
template
<
typename
BaseType_,
typename
... DerivedTypes>
9
struct
DerivedReferenceWrapperVariantTraits
10
{
11
using
BaseType
= BaseType_;
12
13
// we keep a plain derived type tuple for convenience
14
using
DerivedTypesTuple
= std::tuple<DerivedTypes...>;
15
// we keep reference types of derived type tuple for convenience
16
using
ReferenceTuple
= std::tuple<std::reference_wrapper<DerivedTypes>...>;
17
using
ConstReferenceTuple
= std::tuple<std::reference_wrapper<const DerivedTypes>...>;
18
19
using
AllReferenceTuple
=
tuple::concatenate_types_t<ReferenceTuple, ConstReferenceTuple>
;
20
21
// The reference class for this type
22
using
ReferenceVariant
=
tuple::as_variant_type_t<ReferenceTuple>
;
23
using
ConstReferenceVariant
=
tuple::as_variant_type_t<ConstReferenceTuple>
;
24
using
AllReferenceVariant
=
tuple::as_variant_type_t<AllReferenceTuple>
;
25
26
// convenience functions for getting ref variants with constness
27
28
template
<
bool
IsConst>
29
using
ReferenceTuple_const
= std::conditional_t<IsConst, ConstReferenceTuple, ReferenceTuple>;
30
template
<
bool
IsConst>
31
using
ReferenceVariant_const
=
32
std::conditional_t<IsConst, ConstReferenceVariant, ReferenceVariant>;
33
34
static
size_t
get_index
(
const
BaseType
& t);
35
};
36
37
}
// namespace wmtk::utils::metaprogramming
ReferenceWrapperVariant.hpp
as_variant_type.hpp
concatenate_types.hpp
wmtk::utils::metaprogramming::tuple::concatenate_types_t
typename concatenate_types< T, U >::type concatenate_types_t
Definition:
concatenate_types.hpp:26
wmtk::utils::metaprogramming::tuple::as_variant_type_t
typename detail::as_variant_type< T >::type as_variant_type_t
Definition:
as_variant_type.hpp:25
wmtk::utils::metaprogramming
Definition:
as_mesh_variant.cpp:9
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits
Definition:
DerivedReferenceWrapperVariantTraits.hpp:10
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::ReferenceVariant
tuple::as_variant_type_t< ReferenceTuple > ReferenceVariant
Definition:
DerivedReferenceWrapperVariantTraits.hpp:22
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::AllReferenceTuple
tuple::concatenate_types_t< ReferenceTuple, ConstReferenceTuple > AllReferenceTuple
Definition:
DerivedReferenceWrapperVariantTraits.hpp:19
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::DerivedTypesTuple
std::tuple< DerivedTypes... > DerivedTypesTuple
Definition:
DerivedReferenceWrapperVariantTraits.hpp:14
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::ReferenceTuple
std::tuple< std::reference_wrapper< DerivedTypes >... > ReferenceTuple
Definition:
DerivedReferenceWrapperVariantTraits.hpp:16
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::BaseType
BaseType_ BaseType
Definition:
DerivedReferenceWrapperVariantTraits.hpp:11
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::AllReferenceVariant
tuple::as_variant_type_t< AllReferenceTuple > AllReferenceVariant
Definition:
DerivedReferenceWrapperVariantTraits.hpp:24
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::get_index
static size_t get_index(const BaseType &t)
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::ConstReferenceTuple
std::tuple< std::reference_wrapper< const DerivedTypes >... > ConstReferenceTuple
Definition:
DerivedReferenceWrapperVariantTraits.hpp:17
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::ReferenceTuple_const
std::conditional_t< IsConst, ConstReferenceTuple, ReferenceTuple > ReferenceTuple_const
Definition:
DerivedReferenceWrapperVariantTraits.hpp:29
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::ConstReferenceVariant
tuple::as_variant_type_t< ConstReferenceTuple > ConstReferenceVariant
Definition:
DerivedReferenceWrapperVariantTraits.hpp:23
wmtk::utils::metaprogramming::DerivedReferenceWrapperVariantTraits::ReferenceVariant_const
std::conditional_t< IsConst, ConstReferenceVariant, ReferenceVariant > ReferenceVariant_const
Definition:
DerivedReferenceWrapperVariantTraits.hpp:32
src
wmtk
utils
metaprogramming
DerivedReferenceWrapperVariantTraits.hpp
Generated by
1.9.1