CatapultServer  v0.5.0.1 (Elephant)
Traits.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include <type_traits>
24 
25 namespace catapult { namespace utils { namespace traits {
26 
27  // region is_scalar
28 
31  template<typename T>
32  struct is_scalar : std::is_scalar<T> {};
33 
34  template<typename X, typename Y>
35  struct is_scalar<BaseValue<X, Y>> : std::true_type {};
36 
37  template<typename X, typename Y>
38  struct is_scalar<ClampedBaseValue<X, Y>> : std::true_type {};
39 
40  template<typename X>
41  struct is_scalar<ImmutableValue<X>> : std::true_type {};
42 
43  template<typename X>
44  struct is_scalar<const X> : is_scalar<std::remove_const_t<X>> {};
45 
47  template<typename T>
48  inline constexpr bool is_scalar_v = is_scalar<T>::value;
49 
50  // endregion
51 
52  // region is_pod
53 
57  template<typename T>
58  struct is_pod : std::integral_constant<bool, std::is_pod_v<T> && !std::is_pointer_v<T>> {};
59 
60  template<typename X, typename Y>
61  struct is_pod<BaseValue<X, Y>> : std::true_type {};
62 
63  template<typename X, typename Y>
64  struct is_pod<ClampedBaseValue<X, Y>> : std::true_type {};
65 
66  template<typename X>
67  struct is_pod<ImmutableValue<X>> : std::true_type {};
68 
69  template<typename X>
70  struct is_pod<const X> : is_pod<std::remove_const_t<X>> {};
71 
73  template<typename T>
74  inline constexpr bool is_pod_v = is_pod<T>::value;
75 
76  // endregion
77 
78  // region is_base_of_ignore_reference
79 
81  template<typename X, typename Y>
82  struct is_base_of_ignore_reference : std::is_base_of<X, std::remove_reference_t<Y>> {};
83 
85  template<typename X, typename Y>
87 
88  // endregion
89 
90  // region is_type_expression_t
91 
93  template<typename T, typename Enable = void>
94  struct is_type_expression { using type = Enable; };
95 
97  template<typename T, typename Enable = void>
99 
100  // endregion
101 }}}
catapult::utils::traits::is_base_of_ignore_reference_v
constexpr bool is_base_of_ignore_reference_v
true if X is a base of or same as Y (after stripping Y of references), false otherwise.
Definition: Traits.h:86
catapult::utils::traits::is_pod
Definition: Traits.h:58
ClampedBaseValue.h
catapult::utils::BaseValue
Immutable wrapper for basic types, to provide some type-safety.
Definition: BaseValue.h:100
catapult::utils::traits::is_pod_v
constexpr bool is_pod_v
true if T is a standard pod type or a catapult scalar type and is not a pointer type,...
Definition: Traits.h:74
catapult::utils::traits::is_type_expression_t
typename is_type_expression< T, Enable >::type is_type_expression_t
true if the expression is valid and evaluates to a type, false otherwise.
Definition: Traits.h:98
catapult::utils::traits::is_scalar_v
constexpr bool is_scalar_v
true if T is a standard scalar type or a catapult scalar type, false otherwise.
Definition: Traits.h:48
catapult::utils::traits::is_base_of_ignore_reference
Determines if X is a base of or same as Y (after stripping Y of references).
Definition: Traits.h:82
catapult::utils::ImmutableValue
A move-only value wrapper.
Definition: ImmutableValue.h:30
catapult::utils::traits::is_scalar
Definition: Traits.h:32
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ClampedBaseValue
Base values that are constrained to a range of values.
Definition: ClampedBaseValue.h:27
catapult::utils::traits::is_type_expression::type
Enable type
Definition: Traits.h:94
catapult::utils::traits::is_type_expression
Type-based SFINAE helper that evaluates a type expression to a type (if valid) or void (if invalid).
Definition: Traits.h:94