123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580 |
- // -*- C++ -*-
- //===----------------------------------------------------------------------===//
- //
- // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
- // See https://llvm.org/LICENSE.txt for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- //===----------------------------------------------------------------------===//
- #ifndef _LIBCPP___FUNCTIONAL_OPERATIONS_H
- #define _LIBCPP___FUNCTIONAL_OPERATIONS_H
- #include <__config>
- #include <__functional/binary_function.h>
- #include <__functional/unary_function.h>
- #include <__utility/forward.h>
- #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
- # pragma GCC system_header
- #endif
- _LIBCPP_BEGIN_NAMESPACE_STD
- // Arithmetic operations
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS plus
- : __binary_function<_Tp, _Tp, _Tp>
- {
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x + __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS plus<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS minus
- : __binary_function<_Tp, _Tp, _Tp>
- {
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x - __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS minus<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS multiplies
- : __binary_function<_Tp, _Tp, _Tp>
- {
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x * __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS multiplies<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS divides
- : __binary_function<_Tp, _Tp, _Tp>
- {
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x / __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS divides<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS modulus
- : __binary_function<_Tp, _Tp, _Tp>
- {
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x % __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS modulus<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS negate
- : __unary_function<_Tp, _Tp>
- {
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return -__x;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS negate<void>
- {
- template <class _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_Tp&& __x) const
- noexcept(noexcept(- _VSTD::forward<_Tp>(__x)))
- -> decltype( - _VSTD::forward<_Tp>(__x))
- { return - _VSTD::forward<_Tp>(__x); }
- typedef void is_transparent;
- };
- #endif
- // Bitwise operations
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS bit_and
- : __binary_function<_Tp, _Tp, _Tp>
- {
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x & __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS bit_and<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- struct _LIBCPP_TEMPLATE_VIS bit_not
- : __unary_function<_Tp, _Tp>
- {
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return ~__x;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_not);
- template <>
- struct _LIBCPP_TEMPLATE_VIS bit_not<void>
- {
- template <class _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_Tp&& __x) const
- noexcept(noexcept(~_VSTD::forward<_Tp>(__x)))
- -> decltype( ~_VSTD::forward<_Tp>(__x))
- { return ~_VSTD::forward<_Tp>(__x); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS bit_or
- : __binary_function<_Tp, _Tp, _Tp>
- {
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x | __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS bit_or<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS bit_xor
- : __binary_function<_Tp, _Tp, _Tp>
- {
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x ^ __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS bit_xor<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- // Comparison operations
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS equal_to
- : __binary_function<_Tp, _Tp, bool>
- {
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x == __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS equal_to<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS not_equal_to
- : __binary_function<_Tp, _Tp, bool>
- {
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x != __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS not_equal_to<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS less
- : __binary_function<_Tp, _Tp, bool>
- {
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x < __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS less<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS less_equal
- : __binary_function<_Tp, _Tp, bool>
- {
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x <= __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS less_equal<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS greater_equal
- : __binary_function<_Tp, _Tp, bool>
- {
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x >= __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS greater_equal<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS greater
- : __binary_function<_Tp, _Tp, bool>
- {
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x > __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS greater<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- // Logical operations
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS logical_and
- : __binary_function<_Tp, _Tp, bool>
- {
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x && __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS logical_and<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS logical_not
- : __unary_function<_Tp, bool>
- {
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x) const
- {return !__x;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS logical_not<void>
- {
- template <class _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_Tp&& __x) const
- noexcept(noexcept(!_VSTD::forward<_Tp>(__x)))
- -> decltype( !_VSTD::forward<_Tp>(__x))
- { return !_VSTD::forward<_Tp>(__x); }
- typedef void is_transparent;
- };
- #endif
- #if _LIBCPP_STD_VER > 11
- template <class _Tp = void>
- #else
- template <class _Tp>
- #endif
- struct _LIBCPP_TEMPLATE_VIS logical_or
- : __binary_function<_Tp, _Tp, bool>
- {
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x || __y;}
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or);
- #if _LIBCPP_STD_VER > 11
- template <>
- struct _LIBCPP_TEMPLATE_VIS logical_or<void>
- {
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(_VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u)))
- -> decltype( _VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u))
- { return _VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u); }
- typedef void is_transparent;
- };
- #endif
- _LIBCPP_END_NAMESPACE_STD
- #endif // _LIBCPP___FUNCTIONAL_OPERATIONS_H
|