metaprogramming.h Source File
|
CPP API
|
metaprogramming.h
Go to the documentation of this file.
57 using is_small_integral = std::integral_constant<bool, (std::is_integral_v<T> && sizeof(T) <= 4)>;
60 using is_64bit_integral = std::integral_constant<bool, (std::is_integral_v<T> && sizeof(T) == 8)>;
141 // this is significantly cheaper to compile compared to using an index and carrying the entire list,
161 : std::conditional_t<(details::index_of_impl<sizeof...(Types), Type, Types...>() < sizeof...(Types)),
171 constexpr bool is_type_in_list_v = is_type_in_list<Type, Types...>::value;
180 struct index_of_type {
181 static constexpr std::size_t value = details::index_of_impl<sizeof...(Types), Type, Types...>();
191 constexpr std::size_t index_of_type_v = index_of_type<Type, Types...>::value;
198 struct has_duplicates {
206 static constexpr bool has_duplicates_impl(std::index_sequence<Indices...>)
209 // while Indices contains its actual index. Hence, if there is any mismatch, then there is a duplicate.
214 static constexpr bool value = has_duplicates_impl(std::make_index_sequence<sizeof...(Types)>{});
223 constexpr bool has_duplicates_v = has_duplicates<Types...>::value;
231 struct is_ad_type : public std::false_type {
235 struct is_ad_type<ad::internal::active_type<Value, Tape>> : public std::true_type {
239 constexpr bool is_ad_type_v = is_ad_type<T>::value;
An Index with more than one template parameter combines several Index objects.
Definition: index.h:181
Definition: ad.h:31
constexpr std::size_t index_of_impl()
Recursively searches the list (Head, Tail...) for Type.
Definition: metaprogramming.h:132
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
typename not_copyable_if< Cond >::type not_copyable_if_t
equivalent to not_copyable_if<Cond>::type.
Definition: metaprogramming.h:78
std::conditional< Cond, details::NoCopy, details::Empty > not_copyable_if
Defines a type that is not copy constructible or assignable if the specified condition is true.
Definition: metaprogramming.h:71
typename type_at_index< Index, Types... >::type type_at_index_t
The type at the Index-th position in the list Types.
Definition: metaprogramming.h:118
std::integral_constant< bool,(std::is_integral_v< T > &&sizeof(T)==8)> is_64bit_integral
Bool constant to check whether T is an integral type of 64 bits. Used for Json library.
Definition: metaprogramming.h:60
std::integral_constant< bool,(std::is_integral_v< T > &&sizeof(T)<=4)> is_small_integral
Bool constant to check whether T is an integral type of 32 bits or less. Used for Json library.
Definition: metaprogramming.h:57
Definition: metaprogramming.h:51
Definition: metaprogramming.h:42
NoCopy & operator=(NoCopy &&)=default
NoCopy()=default
NoCopy(const NoCopy &)=delete
NoCopy(NoCopy &&)=default
NoCopy & operator=(const NoCopy &)=delete
Get the type at position Index of list (Head, Tail...).
Definition: metaprogramming.h:90
typename type_at_index_impl< Index - 1, Tail... >::type type
Definition: metaprogramming.h:91
Finds the type at the Index-th position in the list Types.
Definition: metaprogramming.h:107
typename details::type_at_index_impl< Index, Types... >::type type
Definition: metaprogramming.h:109
Generated by