28 #ifndef __RTTR_UTILITY_H__
29 #define __RTTR_UTILITY_H__
42 template <
class T, T... I>
struct integer_sequence
44 template <T N>
using append = integer_sequence<T, I..., N>;
45 static std::size_t size () {
return sizeof...(I); }
46 using next = append<
sizeof...(I)>;
50 template <
class T, T Index, std::
size_t N>
51 struct sequence_generator
53 using type =
typename sequence_generator<T, Index - 1, N - 1>::type::next;
56 template <
class T, T Index>
57 struct sequence_generator<T, Index, 0ul> {
using type = integer_sequence<T>; };
59 template <std::size_t... I>
60 using index_sequence = integer_sequence<std::size_t, I...>;
62 template <
class T, T N>
63 using make_integer_sequence =
typename sequence_generator<T, N, N>::type;
65 template <std::
size_t N>
66 using make_index_sequence = make_integer_sequence<std::size_t, N>;
69 using index_sequence_for = make_index_sequence<
sizeof...(T)>;
76 struct remove_first_index_impl
78 using type = index_sequence<>;
81 template<std::size_t First, std::size_t... I>
82 struct remove_first_index_impl<detail::index_sequence<First, I...>>
84 using type = detail::index_sequence<I...>;
88 using remove_first_index =
typename remove_first_index_impl<T>::type;
93 template<
typename,
typename>
94 struct concat_index_sequence { };
96 template<std::size_t... Ts, std::size_t... Us>
97 struct concat_index_sequence<index_sequence<Ts...>, index_sequence<Us...>>
99 using type = index_sequence<Ts..., Us...>;
103 struct remove_last_index_impl;
105 template <
size_t Last>
106 struct remove_last_index_impl<index_sequence<Last>>
108 using type = index_sequence<>;
111 template<std::size_t First, std::size_t... I>
112 struct remove_last_index_impl<index_sequence<First, I...>>
114 using type =
typename concat_index_sequence<
115 index_sequence<First>,
116 typename remove_last_index_impl<index_sequence<I...>>::type
121 using remove_last_index =
typename remove_last_index_impl<T>::type;
132 template<
typename... BoolArgs>
133 static RTTR_INLINE bool check_all_true(
bool arg1, BoolArgs... args) {
return arg1 & check_all_true(args...); }
141 template<
typename ElementType>
142 struct copy_array_helper_impl
144 void operator()(
const ElementType &in, ElementType &out)
150 template<
typename ElementType, std::
size_t Count>
151 struct copy_array_helper_impl<ElementType[Count]> {
152 void operator()(
const ElementType (&in)[Count], ElementType (&out)[Count])
154 for(std::size_t i = 0; i < Count; ++i)
155 copy_array_helper_impl<ElementType>()(in[i], out[i]);
159 template<
typename ElementType, std::
size_t Count>
160 auto copy_array(
const ElementType (&in)[Count], ElementType (&out)[Count])
161 -> ElementType (&)[Count]
163 copy_array_helper_impl<ElementType[Count]>()(in, out);
170 #endif //__RTTR_UTILITY_H__
#define RTTR_INLINE
Definition: core_prerequisites.h:90
#define RTTR_FORCE_INLINE
Definition: core_prerequisites.h:91