diff options
Diffstat (limited to 'libcxx/include/__functional/operations.h')
| -rw-r--r-- | libcxx/include/__functional/operations.h | 95 |
1 files changed, 57 insertions, 38 deletions
diff --git a/libcxx/include/__functional/operations.h b/libcxx/include/__functional/operations.h index 1c73c999db91..8a781efbdbbb 100644 --- a/libcxx/include/__functional/operations.h +++ b/libcxx/include/__functional/operations.h @@ -32,17 +32,18 @@ struct _LIBCPP_TEMPLATE_VIS plus : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -60,17 +61,18 @@ struct _LIBCPP_TEMPLATE_VIS minus : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -88,17 +90,18 @@ struct _LIBCPP_TEMPLATE_VIS multiplies : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -116,17 +119,18 @@ struct _LIBCPP_TEMPLATE_VIS divides : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -144,17 +148,18 @@ struct _LIBCPP_TEMPLATE_VIS modulus : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -172,17 +177,18 @@ struct _LIBCPP_TEMPLATE_VIS negate : __unary_function<_Tp, _Tp> { typedef _Tp __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY auto operator()(_Tp&& __x) const noexcept(noexcept(- _VSTD::forward<_Tp>(__x))) -> decltype( - _VSTD::forward<_Tp>(__x)) @@ -202,17 +208,18 @@ struct _LIBCPP_TEMPLATE_VIS bit_and : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -226,16 +233,17 @@ template <class _Tp = void> struct _LIBCPP_TEMPLATE_VIS bit_not : __unary_function<_Tp, _Tp> { - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY auto operator()(_Tp&& __x) const noexcept(noexcept(~_VSTD::forward<_Tp>(__x))) -> decltype( ~_VSTD::forward<_Tp>(__x)) @@ -253,17 +261,18 @@ struct _LIBCPP_TEMPLATE_VIS bit_or : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -281,17 +290,18 @@ struct _LIBCPP_TEMPLATE_VIS bit_xor : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -311,17 +321,18 @@ struct _LIBCPP_TEMPLATE_VIS equal_to : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -339,17 +350,18 @@ struct _LIBCPP_TEMPLATE_VIS not_equal_to : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -367,17 +379,18 @@ struct _LIBCPP_TEMPLATE_VIS less : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -395,17 +408,18 @@ struct _LIBCPP_TEMPLATE_VIS less_equal : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -423,17 +437,18 @@ struct _LIBCPP_TEMPLATE_VIS greater_equal : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -451,17 +466,18 @@ struct _LIBCPP_TEMPLATE_VIS greater : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -481,17 +497,18 @@ struct _LIBCPP_TEMPLATE_VIS logical_and : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) @@ -509,17 +526,18 @@ struct _LIBCPP_TEMPLATE_VIS logical_not : __unary_function<_Tp, bool> { typedef bool __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY auto operator()(_Tp&& __x) const noexcept(noexcept(!_VSTD::forward<_Tp>(__x))) -> decltype( !_VSTD::forward<_Tp>(__x)) @@ -537,17 +555,18 @@ struct _LIBCPP_TEMPLATE_VIS logical_or : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + _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)) |
