31#ifndef ETL_FUNCTIONAL_INCLUDED
32#define ETL_FUNCTIONAL_INCLUDED
50 class reference_wrapper
56 ETL_CONSTEXPR20
explicit reference_wrapper(T& t_) ETL_NOEXCEPT
61 ETL_CONSTEXPR20 reference_wrapper(
const reference_wrapper& rhs) ETL_NOEXCEPT
66 ETL_CONSTEXPR20 reference_wrapper<T>& operator = (
const reference_wrapper& rhs) ETL_NOEXCEPT
72 ETL_CONSTEXPR20 T& get()
const ETL_NOEXCEPT
77 ETL_CONSTEXPR20
operator T&()
const ETL_NOEXCEPT
96 reference_wrapper<T> ref(reference_wrapper<T> t)
98 return reference_wrapper<T>(t.get());
102 template <
typename T>
109 template <
typename T>
124 template <
typename T>
131 template <
typename T>
132 using unwrap_reference_t =
typename unwrap_reference<T>::type;
138 template <
typename T>
142 template <
typename T>
143 using unwrap_ref_decay_t =
typename unwrap_ref_decay<T>::type;
149 template <
typename TArgumentType,
typename TResultType>
152 typedef TArgumentType argument_type;
153 typedef TResultType result_type;
159 template <
typename TFirstArgumentType,
typename TSecondArgumentType,
typename TResultType>
162 typedef TFirstArgumentType first_argument_type;
163 typedef TSecondArgumentType second_argument_type;
164 typedef TResultType result_type;
168 template <
typename T =
void>
171 typedef T value_type;
173 ETL_CONSTEXPR
bool operator()(
const T &lhs,
const T &rhs)
const
183 typedef int is_transparent;
185 template <
typename T1,
typename T2>
186 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs))
188 return static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs);
194 template <
typename T =
void>
197 typedef T value_type;
199 ETL_CONSTEXPR
bool operator()(
const T& lhs,
const T& rhs)
const
209 typedef int is_transparent;
211 template <
typename T1,
typename T2>
212 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs))
214 return !(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs));
220 template <
typename T =
void>
223 typedef T value_type;
225 ETL_CONSTEXPR
bool operator()(
const T &lhs,
const T &rhs)
const
235 typedef int is_transparent;
237 template <
typename T1,
typename T2>
238 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs))
240 return static_cast<T2&&
>(rhs) <
static_cast<T1&&
>(lhs);
246 template <
typename T =
void>
249 typedef T value_type;
251 ETL_CONSTEXPR
bool operator()(
const T& lhs,
const T& rhs)
const
261 typedef int is_transparent;
263 template <
typename T1,
typename T2>
264 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs))
266 return static_cast<T1&&
>(rhs) <
static_cast<T2&&
>(lhs);
272 template <
typename T =
void>
275 typedef T value_type;
277 ETL_CONSTEXPR
bool operator()(
const T &lhs,
const T &rhs)
const
288 typedef int is_transparent;
290 template <
typename T1,
typename T2>
291 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs))
293 return static_cast<T1&&
>(lhs) ==
static_cast<T2&&
>(rhs);
299 template <
typename T =
void>
302 typedef T value_type;
304 ETL_CONSTEXPR
bool operator()(
const T &lhs,
const T &rhs)
const
306 return !(lhs == rhs);
314 typedef int is_transparent;
316 template <
typename T1,
typename T2>
317 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs))
319 return !(
static_cast<T1&&
>(lhs) ==
static_cast<T2&&
>(rhs));
325 template <
typename TFunction>
326 class binder1st :
public etl::unary_function<typename TFunction::second_argument_type, typename TFunction::result_type>
331 typename TFunction::first_argument_type value;
335 binder1st(
const TFunction& f,
const typename TFunction::first_argument_type& v)
336 : operation(f), value(v)
340 typename TFunction::result_type operator()(
typename TFunction::second_argument_type& x)
const
342 return operation(value, x);
345 typename TFunction::result_type operator()(
const typename TFunction::second_argument_type& x)
const
347 return operation(value, x);
351 template <
typename F,
typename T>
358 template <
typename TFunction >
359 class binder2nd :
public etl::unary_function<typename TFunction::first_argument_type, typename TFunction::result_type>
363 typename TFunction::second_argument_type value;
365 binder2nd(
const TFunction& f,
const typename TFunction::second_argument_type& v)
366 : operation(f), value(v)
370 typename TFunction::result_type operator()(
typename TFunction::first_argument_type& x)
const
372 return operation(x, value);
375 typename TFunction::result_type operator()(
const typename TFunction::first_argument_type& x)
const
377 return operation(x, value);
381 template <
typename F,
typename T>
388 template <
typename T =
void>
391 typedef T first_argument_type;
392 typedef T second_argument_type;
393 typedef T result_type;
395 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
402 template <
typename T =
void>
405 typedef T first_argument_type;
406 typedef T second_argument_type;
407 typedef T result_type;
409 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
416 template <
typename T =
void>
419 typedef T argument_type;
420 typedef T result_type;
422 ETL_CONSTEXPR T operator()(
const T& lhs)
const
429 template <
typename T =
void>
432 typedef T first_argument_type;
433 typedef T second_argument_type;
434 typedef T result_type;
436 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
443 template <
typename T =
void>
446 typedef T first_argument_type;
447 typedef T second_argument_type;
448 typedef T result_type;
450 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
457 template <
typename T =
void>
460 typedef T first_argument_type;
461 typedef T second_argument_type;
462 typedef T result_type;
464 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
471 template <
typename T =
void>
474 typedef T first_argument_type;
475 typedef T second_argument_type;
476 typedef T result_type;
478 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
485 template <
typename T =
void>
488 typedef T first_argument_type;
489 typedef T second_argument_type;
490 typedef T result_type;
492 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
499 template <
typename T =
void>
502 typedef T first_argument_type;
503 typedef T second_argument_type;
504 typedef T result_type;
506 ETL_CONSTEXPR T operator()(
const T& lhs)
const
513 template <
typename T =
void>
516 typedef T first_argument_type;
517 typedef T second_argument_type;
518 typedef T result_type;
520 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
527 template <
typename T =
void>
530 typedef T first_argument_type;
531 typedef T second_argument_type;
532 typedef T result_type;
534 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
541 template <
typename T =
void>
544 typedef T first_argument_type;
545 typedef T second_argument_type;
546 typedef T result_type;
548 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
555 template <
typename T =
void>
558 typedef T first_argument_type;
559 typedef T second_argument_type;
560 typedef T result_type;
562 ETL_CONSTEXPR T operator()(
const T& lhs)
const
569 namespace private_functional
572 template<
typename TReturnType,
typename TClassType,
typename... TArgs>
577 typedef TReturnType(TClassType::* MemberFunctionType)(TArgs...);
579 ETL_CONSTEXPR mem_fn_impl(MemberFunctionType member_function_)
580 : member_function(member_function_)
584 ETL_CONSTEXPR TReturnType operator()(TClassType& instance, TArgs... args)
const
586 return (instance.*member_function)(etl::forward<TArgs>(args)...);
591 MemberFunctionType member_function;
595 template<
typename TReturnType,
typename TClassType,
typename... TArgs>
596 class const_mem_fn_impl
600 typedef TReturnType(TClassType::* MemberFunctionType)(TArgs...)
const;
602 ETL_CONSTEXPR const_mem_fn_impl(MemberFunctionType member_function_)
603 : member_function(member_function_)
607 ETL_CONSTEXPR TReturnType operator()(
const TClassType& instance, TArgs... args)
const
609 return (instance.*member_function)(etl::forward<TArgs>(args)...);
614 MemberFunctionType member_function;
619 template<
typename TReturnType,
typename TClassType,
typename... TArgs>
621 private_functional::mem_fn_impl<TReturnType, TClassType, TArgs...> mem_fn(TReturnType(TClassType::* member_function)(TArgs...))
623 return private_functional::mem_fn_impl<TReturnType, TClassType, TArgs...>(member_function);
627 template<
typename TReturnType,
typename TClassType,
typename... TArgs>
629 private_functional::const_mem_fn_impl<TReturnType, TClassType, TArgs...> mem_fn(TReturnType(TClassType::* member_function)(TArgs...)
const)
631 return private_functional::const_mem_fn_impl<TReturnType, TClassType, TArgs...>(member_function);
Definition functional.h:327
Definition functional.h:360
Definition functional.h:51
bitset_ext
Definition absolute.h:39
binary_function
Definition functional.h:161
Definition functional.h:515
Definition functional.h:557
Definition functional.h:529
Definition functional.h:543
Definition functional.h:445
Definition functional.h:274
Definition functional.h:248
Definition functional.h:222
Definition functional.h:196
Definition functional.h:170
Definition functional.h:473
Definition functional.h:501
Definition functional.h:487
Definition functional.h:404
Definition functional.h:459
Definition functional.h:431
Definition functional.h:418
Definition functional.h:301
Definition functional.h:390
unary_function
Definition functional.h:151
unwrap_ref_decay.
Definition functional.h:139
unwrap_reference.
Definition functional.h:120