31#ifndef ETL_FUNCTION_TRAITS_INCLUDED
32#define ETL_FUNCTION_TRAITS_INCLUDED
45 template <
typename T,
typename Enable =
void>
46 struct function_traits;
51 template <
typename TReturn,
typename... TArgs>
52 struct function_traits<TReturn(TArgs...), void>
56 using function_type = TReturn(TArgs...);
57 using return_type = TReturn;
58 using object_type = void;
59 using argument_types = etl::type_list<TArgs...>;
61 static constexpr bool is_function =
true;
62 static constexpr bool is_member_function =
false;
63 static constexpr bool is_functor =
false;
64 static constexpr bool is_const =
false;
65 static constexpr bool is_volatile =
false;
66 static constexpr bool is_noexcept =
false;
67 static constexpr size_t arity =
sizeof...(TArgs);
69 ETL_DEPRECATED_REASON(
"Use etl::function_traits::arity instead") static constexpr
size_t argument_count = arity;
75 template <typename TReturn, typename... TArgs>
76 struct function_traits<TReturn (*)(TArgs...),
void> : function_traits<TReturn(TArgs...)>
83 template <
typename TReturn,
typename... TArgs>
84 struct function_traits<TReturn (&)(TArgs...),
void> : function_traits<TReturn(TArgs...)>
88 #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE
92 template <
typename TReturn,
typename... TArgs>
93 struct function_traits<TReturn (*)(TArgs...) noexcept,
void> : function_traits<TReturn(TArgs...)>
95 static constexpr bool is_noexcept =
true;
101 template <
typename TReturn,
typename... TArgs>
102 struct function_traits<TReturn (&)(TArgs...)
noexcept,
void> : function_traits<TReturn(TArgs...)>
104 static constexpr bool is_noexcept =
true;
111 template <
typename TReturn,
typename TObject,
typename... TArgs>
112 struct function_traits<TReturn (TObject::*)(TArgs...), void> : function_traits<TReturn(TArgs...)>
114 using object_type = TObject;
115 static constexpr bool is_function =
false;
116 static constexpr bool is_member_function =
true;
122 template <
typename TReturn,
typename TObject,
typename... TArgs>
123 struct function_traits<TReturn (TObject::*)(TArgs...) const, void> : function_traits<TReturn (TObject::*)(TArgs...)>
125 static constexpr bool is_const =
true;
131 template <
typename TReturn,
typename TObject,
typename... TArgs>
132 struct function_traits<TReturn (TObject::*)(TArgs...) volatile, void> : function_traits<TReturn (TObject::*)(TArgs...)>
134 static constexpr bool is_volatile =
true;
140 template <
typename TReturn,
typename TObject,
typename... TArgs>
141 struct function_traits<TReturn (TObject::*)(TArgs...) const volatile, void> : function_traits<TReturn (TObject::*)(TArgs...)>
143 static constexpr bool is_const =
true;
144 static constexpr bool is_volatile =
true;
147 #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE
151 template <
typename TReturn,
typename TObject,
typename... TArgs>
152 struct function_traits<TReturn (TObject::*)(TArgs...) noexcept, void> : function_traits<TReturn (TObject::*)(TArgs...)>
154 static constexpr bool is_noexcept =
true;
160 template <
typename TReturn,
typename TObject,
typename... TArgs>
161 struct function_traits<TReturn (TObject::*)(TArgs...) const noexcept, void> : function_traits<TReturn (TObject::*)(TArgs...) const>
163 static constexpr bool is_noexcept =
true;
169 template <
typename TReturn,
typename TObject,
typename... TArgs>
170 struct function_traits<TReturn (TObject::*)(TArgs...) volatile noexcept, void> : function_traits<TReturn (TObject::*)(TArgs...) volatile>
172 static constexpr bool is_noexcept =
true;
178 template <
typename TReturn,
typename TObject,
typename... TArgs>
179 struct function_traits<TReturn (TObject::*)(TArgs...) const volatile noexcept, void>
180 : function_traits<TReturn (TObject::*)(TArgs...) const volatile>
182 static constexpr bool is_noexcept =
true;
189 template <
typename T>
190 struct function_traits< T, etl::enable_if_t<!etl::is_same<T, etl::remove_cvref_t<T>>::value && !etl::is_class<etl::decay_t<T>>::value>>
191 : function_traits<etl::remove_cvref_t<T>>
199 namespace private_function_traits
204 template <
typename U>
205 using call_operator_ptr_t =
decltype(&U::operator());
211 template <
typename T>
212 struct function_traits< T, etl::enable_if_t<etl::is_class<etl::decay_t<T>>::value && etl::has_unique_call_operator<T>::value>>
213 : function_traits< private_function_traits::call_operator_ptr_t<etl::decay_t<T>> >
215 static constexpr bool is_functor =
true;
222 template <
typename TReturn,
typename... TArgs>
223 constexpr bool function_traits<TReturn(TArgs...),
void>::is_function;
225 template <
typename TReturn,
typename... TArgs>
226 constexpr bool function_traits<TReturn(TArgs...),
void>::is_member_function;
228 template <
typename TReturn,
typename... TArgs>
229 constexpr bool function_traits<TReturn(TArgs...),
void>::is_functor;
231 template <
typename TReturn,
typename... TArgs>
232 constexpr bool function_traits<TReturn(TArgs...),
void>::is_const;
234 template <
typename TReturn,
typename... TArgs>
235 constexpr bool function_traits<TReturn(TArgs...),
void>::is_volatile;
237 template <
typename TReturn,
typename... TArgs>
238 constexpr bool function_traits<TReturn(TArgs...),
void>::is_noexcept;
240 template <
typename TReturn,
typename... TArgs>
241 constexpr size_t function_traits<TReturn(TArgs...),
void>::arity;
244 template <
typename TReturn,
typename TObject,
typename... TArgs>
245 constexpr bool function_traits<TReturn (TObject::*)(TArgs...),
void>::is_function;
247 template <
typename TReturn,
typename TObject,
typename... TArgs>
248 constexpr bool function_traits<TReturn (TObject::*)(TArgs...),
void>::is_member_function;
251 template <
typename TReturn,
typename TObject,
typename... TArgs>
252 constexpr bool function_traits<TReturn (TObject::*)(TArgs...)
const,
void>::is_const;
254 template <
typename TReturn,
typename TObject,
typename... TArgs>
255 constexpr bool function_traits<TReturn (TObject::*)(TArgs...)
volatile,
void>::is_volatile;
257 template <
typename TReturn,
typename TObject,
typename... TArgs>
258 constexpr bool function_traits<TReturn (TObject::*)(TArgs...)
const volatile,
void>::is_const;
260 template <
typename TReturn,
typename TObject,
typename... TArgs>
261 constexpr bool function_traits<TReturn (TObject::*)(TArgs...)
const volatile,
void>::is_volatile;
263 #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE
264 template <
typename TReturn,
typename... TArgs>
265 constexpr bool function_traits<TReturn (*)(TArgs...)
noexcept,
void>::is_noexcept;
267 template <
typename TReturn,
typename TObject,
typename... TArgs>
268 constexpr bool function_traits<TReturn (TObject::*)(TArgs...)
noexcept,
void>::is_noexcept;
270 template <
typename TReturn,
typename TObject,
typename... TArgs>
271 constexpr bool function_traits<TReturn (TObject::*)(TArgs...)
const noexcept,
void>::is_noexcept;
273 template <
typename TReturn,
typename TObject,
typename... TArgs>
274 constexpr bool function_traits< TReturn (TObject::*)(TArgs...)
volatile noexcept,
void>::is_noexcept;
276 template <
typename TReturn,
typename TObject,
typename... TArgs>
277 constexpr bool function_traits< TReturn (TObject::*)(TArgs...)
const volatile noexcept,
void>::is_noexcept;
284 template <
typename T>
285 constexpr bool function_traits< T, etl::enable_if_t<etl::is_class<etl::decay_t<T>>::value && etl::has_unique_call_operator<T>::value>>::is_functor;
bitset_ext
Definition absolute.h:40