1#ifndef TEMPLATE_TOOLS_H
2#define TEMPLATE_TOOLS_H
17template <
class,
class =
void>
27template <
class,
class =
void>
31struct is_field_type<T, typename std::enable_if_t<is_field_class_type<T>::value ||
32 is_arithmetic<T>::value>> : std::true_type {
44template <
typename T,
typename Enable =
void>
50struct base_type_struct<T, typename std::enable_if_t<is_field_class_type<T>::value>> {
52 using type =
typename T::base_type;
56using arithmetic_type =
typename base_type_struct<T>::type;
65template <
typename T,
typename Enable =
void>
71struct inner_type_struct<T, typename std::enable_if_t<hila::is_field_class_type<T>::value>> {
72 using type =
typename T::argument_type;
76using inner_type =
typename inner_type_struct<T>::type;
86template <
typename A,
typename B,
typename Enable =
void>
87struct contains_type : std::integral_constant<bool, std::is_same<A, B>::value> {};
89template <
typename A,
typename B>
90struct contains_type<A, B, typename std::enable_if_t<hila::is_field_class_type<A>::value && !std::is_same<A,B>::value>>
91 : std::integral_constant<bool, hila::contains_type<hila::inner_type<A>, B>::value> {};
94struct contains_type<A, A> : std::integral_constant<bool, true> {};
102template <
typename A,
typename B>
103using type_plus =
decltype(std::declval<A>() + std::declval<B>());
104template <
typename A,
typename B>
105using type_minus =
decltype(std::declval<A>() - std::declval<B>());
106template <
typename A,
typename B>
107using type_mul =
decltype(std::declval<A>() * std::declval<B>());
108template <
typename A,
typename B>
109using type_div =
decltype(std::declval<A>() / std::declval<B>());
119 return *(
reinterpret_cast<const hila::arithmetic_type<T> *
>(&var) + i);
122inline void set_number_in_var(T &var,
int i,
const hila::arithmetic_type<T> val) {
123 *(
reinterpret_cast<hila::arithmetic_type<T> *
>(&var) + i) = val;
138template<
typename T, std::
size_t N>
139struct is_std_array<std::array<T, N>> : std::true_type {};
142struct is_std_vector : std::false_type {};
145struct is_std_vector<std::vector<T>> : std::true_type {};
This file defines all includes for HILA.
Implement hila::swap for gauge fields.
decltype(std::declval< A >()+std::declval< B >()) type_plus
hila::arithmetic_type< T > get_number_in_var(const T &var, int i)