1 #ifndef ZSERIO_TRAITS_H_INC
2 #define ZSERIO_TRAITS_H_INC
11 template <
typename, std::
size_t>
17 template <
typename T,
typename ARRAY_TRAITS>
20 template <
typename ALLOC,
typename T>
29 template <
typename VALUE_TYPE>
30 class NumericTypeWrapper;
32 template <
typename VALUE_TYPE>
35 template <
typename T,
typename =
void>
36 struct is_allocator_impl : std::false_type
40 struct is_allocator_impl<T,
41 std::void_t<typename T::value_type, decltype(std::declval<T>().allocate(0)),
42 decltype(std::declval<T>().deallocate(std::declval<typename T::value_type*>(), 0))>>
47 struct is_array_view : std::false_type
50 template <
typename T,
typename ARRAY_TRAITS>
51 struct is_array_view<ArrayView<T, ARRAY_TRAITS>> : std::true_type
55 constexpr
bool is_array_view_v = is_array_view<T>::value;
58 struct is_view : std::false_type
62 struct is_view<
View<T>> : std::true_type
66 constexpr
bool is_view_v = is_view<T>::value;
69 struct needs_offset_reference : std::negation<is_view<T>>
73 struct needs_offset_reference<Extended<T>>
75 static constexpr
bool value = needs_offset_reference<T>::value;
78 template <
typename ALLOC,
typename T>
79 struct needs_offset_reference<BasicOptional<ALLOC, T>>
81 static constexpr
bool value = needs_offset_reference<T>::value;
85 constexpr
bool needs_offset_reference_v = needs_offset_reference<T>::value;
105 template <
typename... ARGS>
109 template <
typename T,
typename... ARGS>
113 template <
typename... ARGS>
121 template <
typename T,
typename =
void>
125 template <
typename T>
129 template <
typename T,
typename V =
void>
137 template <
typename T,
typename =
void>
141 template <
typename T>
142 struct is_bitmask<T,
std::void_t<decltype(std::declval<T>().getValue()), typename T::ZserioType>>
146 template <
typename T,
typename V =
void>
160 template <
typename T,
size_t Extent>
164 template <
typename T>
173 template <
typename T,
typename =
void>
177 template <
typename T>
179 std::enable_if_t<std::is_base_of_v<detail::NumericTypeWrapper<typename T::ValueType>, T>>>
183 template <
typename T,
typename V =
void>
189 template <
typename T,
typename =
void>
193 template <
typename T>
195 std::enable_if_t<std::is_base_of_v<detail::DynIntWrapper<typename T::ValueType>, T>>> : std::true_type
198 template <
typename T,
typename V =
void>
205 template <
typename T,
typename =
void>
209 template <
typename T>
213 template <
typename T>
222 template <
typename T,
typename =
void>
228 template <
typename T>
234 template <
typename T,
typename V =
void>
243 template <
typename T,
typename =
void>
249 template <
typename T>
255 template <
typename T,
typename V =
void>
266 template <
typename T,
typename ALLOC,
typename... ARGS>
269 if constexpr (std::is_constructible_v<T, ARGS..., ALLOC>)
271 return T(std::forward<ARGS>(args)..., allocator);
275 return T(std::forward<ARGS>(args)...);
285 template <
typename T,
typename ALLOC,
typename U, std::enable_if_t<is_numeric_wrapper_v<T>,
int> = 0>
288 return T(
static_cast<typename T::ValueType
>(value));
constexpr bool is_complete_v
typename offset_field_reference< T, V >::type offset_field_reference_t
constexpr bool is_allocator_v
constexpr bool is_dyn_int_wrapper_v
constexpr T constructWithAllocator(const ALLOC &allocator, ARGS &&... args)
constexpr bool is_numeric_wrapper_v
constexpr bool is_bitmask_v
View(T, ARGS &&...) -> View< T >
constexpr bool has_allocator_v
typename view_type< T, V >::type view_type_t
constexpr bool is_first_allocator_v