Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
varianttyperesolver.h
Go to the documentation of this file.
1 
18 #ifndef ION_BASE_VARIANTTYPERESOLVER_H_
19 #define ION_BASE_VARIANTTYPERESOLVER_H_
20 
21 #include "ion/base/type_structs.h"
22 #include "ion/base/variant.h"
23 
24 namespace ion {
25 namespace base {
26 
27 namespace internal {
28 
30 
35 
36 
39 template <typename T, typename Base>
43  T, void>::Type Type;
44 };
45 
50 template <typename VariantType, typename TypeToResolve, typename Base = void>
52  typedef void Type;
53 };
54 
55 #define ION_SPECIALIZE_VARIANT_RESOLVER_HELPER(VariantSubType) \
56 template <typename VariantType, typename TypeToResolve> \
57 struct ResolverHelper< \
58  VariantType, TypeToResolve, \
59  typename IsSameOrDerivedFrom<TypeToResolve, \
60  typename VariantType::VariantSubType>::Type> { \
61  typedef typename VariantType::VariantSubType Type; \
62 }
63 
104 
105 #undef ION_SPECIALIZE_VARIANT_RESOLVER_HELPER
106 
107 } // namespace internal
108 
110 
136 
137 
138 template <typename VariantType, typename TypeToResolve>
140  typedef typename internal::ResolverHelper<
141  VariantType, TypeToResolve, TypeToResolve>::Type Type;
142 };
143 
144 } // namespace base
145 } // namespace ion
146 
147 #endif // ION_BASE_VARIANTTYPERESOLVER_H_
internal::ResolverHelper< VariantType, TypeToResolve, TypeToResolve >::Type Type
ConditionalType< IsSameType< Base, T >::value||IsBaseOf< Base, T >::value, T, void >::Type Type
This struct is specialized for each of the defined types supported by a Variant.
The VariantTypeResolver struct allows users of the Variant class to determine which type defined by a...
IsBaseOf is similar to std::is_base_of.
Definition: type_structs.h:45
ConditionalType is similar to std::conditional.
Definition: type_structs.h:74
ION_SPECIALIZE_VARIANT_RESOLVER_HELPER(Type1)