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
84 template <
typename... TArgs>
85 ETL_CONSTEXPR20
auto operator()(TArgs&&... args)
const
86 noexcept(
noexcept(etl::declval<T&>()(etl::declval<TArgs>()...))) ->
decltype(etl::declval<T&>()(etl::declval<TArgs>()...))
88 return get()(etl::forward<TArgs>(args)...);
105 template <
typename T>
106 reference_wrapper<T> ref(reference_wrapper<T> t)
108 return reference_wrapper<T>(t.get());
112 template <
typename T>
119 template <
typename T>
134 template <
typename T>
141 template <
typename T>
142 using unwrap_reference_t =
typename unwrap_reference<T>::type;
148 template <
typename T>
154 template <
typename T>
155 using unwrap_ref_decay_t =
typename unwrap_ref_decay<T>::type;
162 template <
typename T>
167 template <
typename T>
173 template <
typename T>
174 inline constexpr bool is_reference_wrapper_v = is_reference_wrapper<T>::value;
180 template <
typename TArgumentType,
typename TResultType>
183 typedef TArgumentType argument_type;
184 typedef TResultType result_type;
190 template <
typename TFirstArgumentType,
typename TSecondArgumentType,
typename TResultType>
193 typedef TFirstArgumentType first_argument_type;
194 typedef TSecondArgumentType second_argument_type;
195 typedef TResultType result_type;
199 template <
typename T =
void>
202 typedef T value_type;
204 ETL_CONSTEXPR
bool operator()(
const T& lhs,
const T& rhs)
const
214 typedef int is_transparent;
216 template <
typename T1,
typename T2>
217 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs))
219 return static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs);
225 template <
typename T =
void>
228 typedef T value_type;
230 ETL_CONSTEXPR
bool operator()(
const T& lhs,
const T& rhs)
const
240 typedef int is_transparent;
242 template <
typename T1,
typename T2>
243 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(!(
static_cast<T2&&
>(rhs) <
static_cast<T1&&
>(lhs)))
245 return !(
static_cast<T2&&
>(rhs) <
static_cast<T1&&
>(lhs));
251 template <
typename T =
void>
254 typedef T value_type;
256 ETL_CONSTEXPR
bool operator()(
const T& lhs,
const T& rhs)
const
266 typedef int is_transparent;
268 template <
typename T1,
typename T2>
269 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(
static_cast<T2&&
>(rhs) <
static_cast<T1&&
>(lhs))
271 return static_cast<T2&&
>(rhs) <
static_cast<T1&&
>(lhs);
277 template <
typename T =
void>
280 typedef T value_type;
282 ETL_CONSTEXPR
bool operator()(
const T& lhs,
const T& rhs)
const
292 typedef int is_transparent;
294 template <
typename T1,
typename T2>
295 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(!(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs)))
297 return !(
static_cast<T1&&
>(lhs) <
static_cast<T2&&
>(rhs));
303 template <
typename T =
void>
306 typedef T value_type;
308 ETL_CONSTEXPR
bool operator()(
const T& lhs,
const T& rhs)
const
319 typedef int is_transparent;
321 template <
typename T1,
typename T2>
322 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(
static_cast<T1&&
>(lhs) ==
static_cast<T2&&
>(rhs))
324 return static_cast<T1&&
>(lhs) ==
static_cast<T2&&
>(rhs);
330 template <
typename T =
void>
333 typedef T value_type;
335 ETL_CONSTEXPR
bool operator()(
const T& lhs,
const T& rhs)
const
337 return !(lhs == rhs);
345 typedef int is_transparent;
347 template <
typename T1,
typename T2>
348 constexpr auto operator()(T1&& lhs, T2&& rhs)
const ->
decltype(!(
static_cast<T1&&
>(lhs) ==
static_cast<T2&&
>(rhs)))
350 return !(
static_cast<T1&&
>(lhs) ==
static_cast<T2&&
>(rhs));
356 template <
typename TFunction>
357 class binder1st :
public etl::unary_function<typename TFunction::second_argument_type, typename TFunction::result_type>
362 typename TFunction::first_argument_type value;
366 binder1st(
const TFunction& f,
const typename TFunction::first_argument_type& v)
372 typename TFunction::result_type operator()(
typename TFunction::second_argument_type& x)
const
374 return operation(value, x);
377 typename TFunction::result_type operator()(
const typename TFunction::second_argument_type& x)
const
379 return operation(value, x);
383 template <
typename F,
typename T>
390 template <
typename TFunction >
391 class binder2nd :
public etl::unary_function<typename TFunction::first_argument_type, typename TFunction::result_type>
396 typename TFunction::second_argument_type value;
400 binder2nd(
const TFunction& f,
const typename TFunction::second_argument_type& v)
406 typename TFunction::result_type operator()(
typename TFunction::first_argument_type& x)
const
408 return operation(x, value);
411 typename TFunction::result_type operator()(
const typename TFunction::first_argument_type& x)
const
413 return operation(x, value);
417 template <
typename F,
typename T>
424 template <
typename T =
void>
427 typedef T first_argument_type;
428 typedef T second_argument_type;
429 typedef T result_type;
431 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
438 template <
typename T =
void>
441 typedef T first_argument_type;
442 typedef T second_argument_type;
443 typedef T result_type;
445 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
452 template <
typename T =
void>
455 typedef T argument_type;
456 typedef T result_type;
458 ETL_CONSTEXPR T operator()(
const T& lhs)
const
465 template <
typename T =
void>
468 typedef T first_argument_type;
469 typedef T second_argument_type;
470 typedef T result_type;
472 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
479 template <
typename T =
void>
482 typedef T first_argument_type;
483 typedef T second_argument_type;
484 typedef T result_type;
486 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
493 template <
typename T =
void>
496 typedef T first_argument_type;
497 typedef T second_argument_type;
498 typedef T result_type;
500 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
507 template <
typename T =
void>
510 typedef T first_argument_type;
511 typedef T second_argument_type;
512 typedef T result_type;
514 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
521 template <
typename T =
void>
524 typedef T first_argument_type;
525 typedef T second_argument_type;
526 typedef T result_type;
528 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
535 template <
typename T =
void>
538 typedef T first_argument_type;
539 typedef T second_argument_type;
540 typedef T result_type;
542 ETL_CONSTEXPR T operator()(
const T& lhs)
const
549 template <
typename T =
void>
552 typedef T first_argument_type;
553 typedef T second_argument_type;
554 typedef T result_type;
556 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
563 template <
typename T =
void>
566 typedef T first_argument_type;
567 typedef T second_argument_type;
568 typedef T result_type;
570 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
577 template <
typename T =
void>
580 typedef T first_argument_type;
581 typedef T second_argument_type;
582 typedef T result_type;
584 ETL_CONSTEXPR T operator()(
const T& lhs,
const T& rhs)
const
591 template <
typename T =
void>
594 typedef T first_argument_type;
595 typedef T second_argument_type;
596 typedef T result_type;
598 ETL_CONSTEXPR T operator()(
const T& lhs)
const
605 namespace private_functional
608 template <
typename TReturnType,
typename TClassType,
typename... TArgs>
613 typedef TReturnType (TClassType::*MemberFunctionType)(TArgs...);
615 ETL_CONSTEXPR mem_fn_impl(MemberFunctionType member_function_)
616 : member_function(member_function_)
620 ETL_CONSTEXPR TReturnType operator()(TClassType& instance, TArgs... args)
const
622 return (instance.*member_function)(etl::forward<TArgs>(args)...);
627 MemberFunctionType member_function;
631 template <
typename TReturnType,
typename TClassType,
typename... TArgs>
632 class const_mem_fn_impl
636 typedef TReturnType (TClassType::*MemberFunctionType)(TArgs...)
const;
638 ETL_CONSTEXPR const_mem_fn_impl(MemberFunctionType member_function_)
639 : member_function(member_function_)
643 ETL_CONSTEXPR TReturnType operator()(
const TClassType& instance, TArgs... args)
const
645 return (instance.*member_function)(etl::forward<TArgs>(args)...);
650 MemberFunctionType member_function;
655 template <
typename TReturnType,
typename TClassType,
typename... TArgs>
656 ETL_CONSTEXPR private_functional::mem_fn_impl<TReturnType, TClassType, TArgs...> mem_fn(TReturnType (TClassType::*member_function)(TArgs...))
658 return private_functional::mem_fn_impl<TReturnType, TClassType, TArgs...>(member_function);
662 template <
typename TReturnType,
typename TClassType,
typename... TArgs>
663 ETL_CONSTEXPR private_functional::const_mem_fn_impl<TReturnType, TClassType, TArgs...> mem_fn(TReturnType (TClassType::*member_function)(TArgs...)
666 return private_functional::const_mem_fn_impl<TReturnType, TClassType, TArgs...>(member_function);
674 constexpr T&& operator()(T&& t)
const noexcept
676 return etl::forward<T>(t);
686 template <
typename T,
typename U>
687 constexpr auto operator()(T&& t, U&& u)
const ->
decltype(
static_cast<T&&
>(t) ==
static_cast<U&&
>(u))
689 return static_cast<T&&
>(t) ==
static_cast<U&&
>(u);
695 template <
typename T,
typename U>
696 constexpr auto operator()(T&& t, U&& u)
const ->
decltype(
static_cast<T&&
>(t) <
static_cast<U&&
>(u))
698 return static_cast<T&&
>(t) <
static_cast<U&&
>(u);
Definition functional.h:358
Definition functional.h:392
Definition functional.h:51
bitset_ext
Definition absolute.h:40
integral_constant< bool, false > false_type
integral_constant specialisations
Definition type_traits.h:80
binary_function
Definition functional.h:192
Definition functional.h:551
Definition functional.h:593
Definition functional.h:565
Definition functional.h:579
Definition functional.h:481
Definition functional.h:305
Definition functional.h:279
Definition functional.h:253
Definition functional.h:164
Definition functional.h:227
Definition functional.h:201
Definition functional.h:509
Definition functional.h:537
Definition functional.h:523
Definition functional.h:440
Definition functional.h:495
Definition functional.h:467
Definition functional.h:454
Definition functional.h:332
Definition functional.h:426
unary_function
Definition functional.h:182
unwrap_ref_decay.
Definition functional.h:150
unwrap_reference.
Definition functional.h:130