Wildmeshing Toolkit
DerivedReferenceWrapperVariantTraits.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <tuple>
3 
8 template <typename BaseType_, typename... DerivedTypes>
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 
20 
21  // The reference class for this type
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>
32  std::conditional_t<IsConst, ConstReferenceVariant, ReferenceVariant>;
33 
34  static size_t get_index(const BaseType& t);
35 };
36 
37 } // namespace wmtk::utils::metaprogramming
typename concatenate_types< T, U >::type concatenate_types_t
typename detail::as_variant_type< T >::type as_variant_type_t
tuple::concatenate_types_t< ReferenceTuple, ConstReferenceTuple > AllReferenceTuple
std::tuple< std::reference_wrapper< const DerivedTypes >... > ConstReferenceTuple
std::conditional_t< IsConst, ConstReferenceTuple, ReferenceTuple > ReferenceTuple_const
std::conditional_t< IsConst, ConstReferenceVariant, ReferenceVariant > ReferenceVariant_const