diff options
Diffstat (limited to 'contrib/libc++/include/functional')
-rw-r--r-- | contrib/libc++/include/functional | 321 |
1 files changed, 152 insertions, 169 deletions
diff --git a/contrib/libc++/include/functional b/contrib/libc++/include/functional index 581f965..4f8ec65 100644 --- a/contrib/libc++/include/functional +++ b/contrib/libc++/include/functional @@ -212,6 +212,13 @@ template <class F> unspecified not_fn(F&& f); // C++17 template<class T> struct is_bind_expression; template<class T> struct is_placeholder; + // See C++14 20.9.9, Function object binders +template <class T> constexpr bool is_bind_expression_v + = is_bind_expression<T>::value; // C++17 +template <class T> constexpr int is_placeholder_v + = is_placeholder<T>::value; // C++17 + + template<class Fn, class... BoundArgs> unspecified bind(Fn&&, BoundArgs&&...); template<class R, class Fn, class... BoundArgs> @@ -386,15 +393,15 @@ public: template<class F> function(F); template<Allocator Alloc> - function(allocator_arg_t, const Alloc&) noexcept; + function(allocator_arg_t, const Alloc&) noexcept; // removed in C++17 template<Allocator Alloc> - function(allocator_arg_t, const Alloc&, nullptr_t) noexcept; + function(allocator_arg_t, const Alloc&, nullptr_t) noexcept; // removed in C++17 template<Allocator Alloc> - function(allocator_arg_t, const Alloc&, const function&); + function(allocator_arg_t, const Alloc&, const function&); // removed in C++17 template<Allocator Alloc> - function(allocator_arg_t, const Alloc&, function&&); + function(allocator_arg_t, const Alloc&, function&&); // removed in C++17 template<class F, Allocator Alloc> - function(allocator_arg_t, const Alloc&, F); + function(allocator_arg_t, const Alloc&, F); // removed in C++17 function& operator=(const function&); function& operator=(function&&) noexcept; @@ -492,7 +499,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY plus : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS plus : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const @@ -501,7 +508,7 @@ struct _LIBCPP_TYPE_VIS_ONLY plus : binary_function<_Tp, _Tp, _Tp> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY plus<void> +struct _LIBCPP_TEMPLATE_VIS plus<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -519,7 +526,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY minus : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS minus : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const @@ -528,7 +535,7 @@ struct _LIBCPP_TYPE_VIS_ONLY minus : binary_function<_Tp, _Tp, _Tp> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY minus<void> +struct _LIBCPP_TEMPLATE_VIS minus<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -546,7 +553,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY multiplies : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS multiplies : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const @@ -555,7 +562,7 @@ struct _LIBCPP_TYPE_VIS_ONLY multiplies : binary_function<_Tp, _Tp, _Tp> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY multiplies<void> +struct _LIBCPP_TEMPLATE_VIS multiplies<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -573,7 +580,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY divides : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS divides : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const @@ -582,7 +589,7 @@ struct _LIBCPP_TYPE_VIS_ONLY divides : binary_function<_Tp, _Tp, _Tp> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY divides<void> +struct _LIBCPP_TEMPLATE_VIS divides<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -600,7 +607,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY modulus : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS modulus : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const @@ -609,7 +616,7 @@ struct _LIBCPP_TYPE_VIS_ONLY modulus : binary_function<_Tp, _Tp, _Tp> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY modulus<void> +struct _LIBCPP_TEMPLATE_VIS modulus<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -627,7 +634,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY negate : unary_function<_Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS negate : unary_function<_Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const @@ -636,7 +643,7 @@ struct _LIBCPP_TYPE_VIS_ONLY negate : unary_function<_Tp, _Tp> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY negate<void> +struct _LIBCPP_TEMPLATE_VIS negate<void> { template <class _Tp> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -654,7 +661,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY equal_to : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_TEMPLATE_VIS equal_to : binary_function<_Tp, _Tp, bool> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const @@ -663,7 +670,7 @@ struct _LIBCPP_TYPE_VIS_ONLY equal_to : binary_function<_Tp, _Tp, bool> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY equal_to<void> +struct _LIBCPP_TEMPLATE_VIS equal_to<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -681,7 +688,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY not_equal_to : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_TEMPLATE_VIS not_equal_to : binary_function<_Tp, _Tp, bool> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const @@ -690,7 +697,7 @@ struct _LIBCPP_TYPE_VIS_ONLY not_equal_to : binary_function<_Tp, _Tp, bool> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY not_equal_to<void> +struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -708,7 +715,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY greater : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const @@ -717,7 +724,7 @@ struct _LIBCPP_TYPE_VIS_ONLY greater : binary_function<_Tp, _Tp, bool> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY greater<void> +struct _LIBCPP_TEMPLATE_VIS greater<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -737,7 +744,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY greater_equal : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const @@ -746,7 +753,7 @@ struct _LIBCPP_TYPE_VIS_ONLY greater_equal : binary_function<_Tp, _Tp, bool> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY greater_equal<void> +struct _LIBCPP_TEMPLATE_VIS greater_equal<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -764,7 +771,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY less_equal : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_TEMPLATE_VIS less_equal : binary_function<_Tp, _Tp, bool> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const @@ -773,7 +780,7 @@ struct _LIBCPP_TYPE_VIS_ONLY less_equal : binary_function<_Tp, _Tp, bool> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY less_equal<void> +struct _LIBCPP_TEMPLATE_VIS less_equal<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -791,7 +798,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY logical_and : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_TEMPLATE_VIS logical_and : binary_function<_Tp, _Tp, bool> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const @@ -800,7 +807,7 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_and : binary_function<_Tp, _Tp, bool> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY logical_and<void> +struct _LIBCPP_TEMPLATE_VIS logical_and<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -818,7 +825,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY logical_or : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_TEMPLATE_VIS logical_or : binary_function<_Tp, _Tp, bool> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const @@ -827,7 +834,7 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_or : binary_function<_Tp, _Tp, bool> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY logical_or<void> +struct _LIBCPP_TEMPLATE_VIS logical_or<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -845,7 +852,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY logical_not : unary_function<_Tp, bool> +struct _LIBCPP_TEMPLATE_VIS logical_not : unary_function<_Tp, bool> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x) const @@ -854,7 +861,7 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_not : unary_function<_Tp, bool> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY logical_not<void> +struct _LIBCPP_TEMPLATE_VIS logical_not<void> { template <class _Tp> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -872,7 +879,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY bit_and : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS bit_and : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const @@ -881,7 +888,7 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_and : binary_function<_Tp, _Tp, _Tp> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY bit_and<void> +struct _LIBCPP_TEMPLATE_VIS bit_and<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -899,7 +906,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY bit_or : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS bit_or : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const @@ -908,7 +915,7 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_or : binary_function<_Tp, _Tp, _Tp> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY bit_or<void> +struct _LIBCPP_TEMPLATE_VIS bit_or<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -926,7 +933,7 @@ template <class _Tp = void> #else template <class _Tp> #endif -struct _LIBCPP_TYPE_VIS_ONLY bit_xor : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS bit_xor : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const @@ -935,7 +942,7 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_xor : binary_function<_Tp, _Tp, _Tp> #if _LIBCPP_STD_VER > 11 template <> -struct _LIBCPP_TYPE_VIS_ONLY bit_xor<void> +struct _LIBCPP_TEMPLATE_VIS bit_xor<void> { template <class _T1, class _T2> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -950,7 +957,7 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_xor<void> #if _LIBCPP_STD_VER > 11 template <class _Tp = void> -struct _LIBCPP_TYPE_VIS_ONLY bit_not : unary_function<_Tp, _Tp> +struct _LIBCPP_TEMPLATE_VIS bit_not : unary_function<_Tp, _Tp> { _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const @@ -958,7 +965,7 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_not : unary_function<_Tp, _Tp> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY bit_not<void> +struct _LIBCPP_TEMPLATE_VIS bit_not<void> { template <class _Tp> _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -971,7 +978,7 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_not<void> #endif template <class _Predicate> -class _LIBCPP_TYPE_VIS_ONLY unary_negate +class _LIBCPP_TEMPLATE_VIS unary_negate : public unary_function<typename _Predicate::argument_type, bool> { _Predicate __pred_; @@ -990,7 +997,7 @@ unary_negate<_Predicate> not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);} template <class _Predicate> -class _LIBCPP_TYPE_VIS_ONLY binary_negate +class _LIBCPP_TEMPLATE_VIS binary_negate : public binary_function<typename _Predicate::first_argument_type, typename _Predicate::second_argument_type, bool> @@ -1012,7 +1019,7 @@ binary_negate<_Predicate> not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);} template <class __Operation> -class _LIBCPP_TYPE_VIS_ONLY binder1st +class _LIBCPP_TEMPLATE_VIS binder1st : public unary_function<typename __Operation::second_argument_type, typename __Operation::result_type> { @@ -1038,7 +1045,7 @@ bind1st(const __Operation& __op, const _Tp& __x) {return binder1st<__Operation>(__op, __x);} template <class __Operation> -class _LIBCPP_TYPE_VIS_ONLY binder2nd +class _LIBCPP_TEMPLATE_VIS binder2nd : public unary_function<typename __Operation::first_argument_type, typename __Operation::result_type> { @@ -1064,7 +1071,7 @@ bind2nd(const __Operation& __op, const _Tp& __x) {return binder2nd<__Operation>(__op, __x);} template <class _Arg, class _Result> -class _LIBCPP_TYPE_VIS_ONLY pointer_to_unary_function +class _LIBCPP_TEMPLATE_VIS pointer_to_unary_function : public unary_function<_Arg, _Result> { _Result (*__f_)(_Arg); @@ -1082,7 +1089,7 @@ ptr_fun(_Result (*__f)(_Arg)) {return pointer_to_unary_function<_Arg,_Result>(__f);} template <class _Arg1, class _Arg2, class _Result> -class _LIBCPP_TYPE_VIS_ONLY pointer_to_binary_function +class _LIBCPP_TEMPLATE_VIS pointer_to_binary_function : public binary_function<_Arg1, _Arg2, _Result> { _Result (*__f_)(_Arg1, _Arg2); @@ -1100,7 +1107,7 @@ ptr_fun(_Result (*__f)(_Arg1,_Arg2)) {return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);} template<class _Sp, class _Tp> -class _LIBCPP_TYPE_VIS_ONLY mem_fun_t : public unary_function<_Tp*, _Sp> +class _LIBCPP_TEMPLATE_VIS mem_fun_t : public unary_function<_Tp*, _Sp> { _Sp (_Tp::*__p_)(); public: @@ -1111,7 +1118,7 @@ public: }; template<class _Sp, class _Tp, class _Ap> -class _LIBCPP_TYPE_VIS_ONLY mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp> +class _LIBCPP_TEMPLATE_VIS mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap); public: @@ -1134,7 +1141,7 @@ mem_fun(_Sp (_Tp::*__f)(_Ap)) {return mem_fun1_t<_Sp,_Tp,_Ap>(__f);} template<class _Sp, class _Tp> -class _LIBCPP_TYPE_VIS_ONLY mem_fun_ref_t : public unary_function<_Tp, _Sp> +class _LIBCPP_TEMPLATE_VIS mem_fun_ref_t : public unary_function<_Tp, _Sp> { _Sp (_Tp::*__p_)(); public: @@ -1145,7 +1152,7 @@ public: }; template<class _Sp, class _Tp, class _Ap> -class _LIBCPP_TYPE_VIS_ONLY mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp> +class _LIBCPP_TEMPLATE_VIS mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap); public: @@ -1168,7 +1175,7 @@ mem_fun_ref(_Sp (_Tp::*__f)(_Ap)) {return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);} template <class _Sp, class _Tp> -class _LIBCPP_TYPE_VIS_ONLY const_mem_fun_t : public unary_function<const _Tp*, _Sp> +class _LIBCPP_TEMPLATE_VIS const_mem_fun_t : public unary_function<const _Tp*, _Sp> { _Sp (_Tp::*__p_)() const; public: @@ -1179,7 +1186,7 @@ public: }; template <class _Sp, class _Tp, class _Ap> -class _LIBCPP_TYPE_VIS_ONLY const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp> +class _LIBCPP_TEMPLATE_VIS const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap) const; public: @@ -1202,7 +1209,7 @@ mem_fun(_Sp (_Tp::*__f)(_Ap) const) {return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);} template <class _Sp, class _Tp> -class _LIBCPP_TYPE_VIS_ONLY const_mem_fun_ref_t : public unary_function<_Tp, _Sp> +class _LIBCPP_TEMPLATE_VIS const_mem_fun_ref_t : public unary_function<_Tp, _Sp> { _Sp (_Tp::*__p_)() const; public: @@ -1213,7 +1220,7 @@ public: }; template <class _Sp, class _Tp, class _Ap> -class _LIBCPP_TYPE_VIS_ONLY const_mem_fun1_ref_t +class _LIBCPP_TEMPLATE_VIS const_mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap) const; @@ -1382,7 +1389,17 @@ class _LIBCPP_EXCEPTION_ABI bad_function_call { }; -template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined +_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE +void __throw_bad_function_call() +{ +#ifndef _LIBCPP_NO_EXCEPTIONS + throw bad_function_call(); +#else + _VSTD::abort(); +#endif +} + +template<class _Fp> class _LIBCPP_TEMPLATE_VIS function; // undefined namespace __function { @@ -1558,7 +1575,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() const _NOEXCEPT } // __function template<class _Rp, class ..._ArgTypes> -class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_ArgTypes...)> +class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)> : public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>, public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)> { @@ -1595,13 +1612,12 @@ public: function(nullptr_t) _NOEXCEPT : __f_(0) {} function(const function&); function(function&&) _NOEXCEPT; - template<class _Fp> - function(_Fp, typename enable_if - < - __callable<_Fp>::value && - !is_same<_Fp, function>::value - >::type* = 0); + template<class _Fp, class = typename enable_if< + __callable<_Fp>::value && !is_same<_Fp, function>::value + >::type> + function(_Fp); +#if _LIBCPP_STD_VER <= 14 template<class _Alloc> _LIBCPP_INLINE_VISIBILITY function(allocator_arg_t, const _Alloc&) _NOEXCEPT : __f_(0) {} @@ -1612,9 +1628,9 @@ public: function(allocator_arg_t, const _Alloc&, const function&); template<class _Alloc> function(allocator_arg_t, const _Alloc&, function&&); - template<class _Fp, class _Alloc> - function(allocator_arg_t, const _Alloc& __a, _Fp __f, - typename enable_if<__callable<_Fp>::value>::type* = 0); + template<class _Fp, class _Alloc, class = typename enable_if<__callable<_Fp>::value>::type> + function(allocator_arg_t, const _Alloc& __a, _Fp __f); +#endif function& operator=(const function&); function& operator=(function&&) _NOEXCEPT; @@ -1675,6 +1691,7 @@ function<_Rp(_ArgTypes...)>::function(const function& __f) __f_ = __f.__f_->__clone(); } +#if _LIBCPP_STD_VER <= 14 template<class _Rp, class ..._ArgTypes> template <class _Alloc> function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, @@ -1690,6 +1707,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, else __f_ = __f.__f_->__clone(); } +#endif template<class _Rp, class ..._ArgTypes> function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT @@ -1708,6 +1726,7 @@ function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT } } +#if _LIBCPP_STD_VER <= 14 template<class _Rp, class ..._ArgTypes> template <class _Alloc> function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, @@ -1726,15 +1745,11 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, __f.__f_ = 0; } } +#endif template<class _Rp, class ..._ArgTypes> -template <class _Fp> -function<_Rp(_ArgTypes...)>::function(_Fp __f, - typename enable_if - < - __callable<_Fp>::value && - !is_same<_Fp, function>::value - >::type*) +template <class _Fp, class> +function<_Rp(_ArgTypes...)>::function(_Fp __f) : __f_(0) { if (__function::__not_null(__f)) @@ -1756,10 +1771,10 @@ function<_Rp(_ArgTypes...)>::function(_Fp __f, } } +#if _LIBCPP_STD_VER <= 14 template<class _Rp, class ..._ArgTypes> -template <class _Fp, class _Alloc> -function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, - typename enable_if<__callable<_Fp>::value>::type*) +template <class _Fp, class _Alloc, class> +function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f) : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; @@ -1782,6 +1797,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp _ } } } +#endif template<class _Rp, class ..._ArgTypes> function<_Rp(_ArgTypes...)>& @@ -1854,6 +1870,8 @@ template<class _Rp, class ..._ArgTypes> void function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT { + if (_VSTD::addressof(__f) == this) + return; if ((void *)__f_ == &__buf_ && (void *)__f.__f_ == &__f.__buf_) { typename aligned_storage<sizeof(__buf_)>::type __tempbuf; @@ -1891,10 +1909,8 @@ template<class _Rp, class ..._ArgTypes> _Rp function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const { -#ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) - throw bad_function_call(); -#endif // _LIBCPP_NO_EXCEPTIONS + __throw_bad_function_call(); return (*__f_)(_VSTD::forward<_ArgTypes>(__arg)...); } @@ -1968,13 +1984,23 @@ swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCE //============================================================================== template<class _Tp> struct __is_bind_expression : public false_type {}; -template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression +template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_bind_expression : public __is_bind_expression<typename remove_cv<_Tp>::type> {}; +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value; +#endif + template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {}; -template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_placeholder +template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_placeholder : public __is_placeholder<typename remove_cv<_Tp>::type> {}; +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +constexpr size_t is_placeholder_v = is_placeholder<_Tp>::value; +#endif + namespace placeholders { @@ -2204,36 +2230,6 @@ private: typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices; public: -#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS - - _LIBCPP_INLINE_VISIBILITY - __bind(const __bind& __b) - : __f_(__b.__f_), - __bound_args_(__b.__bound_args_) {} - - _LIBCPP_INLINE_VISIBILITY - __bind& operator=(const __bind& __b) - { - __f_ = __b.__f_; - __bound_args_ = __b.__bound_args_; - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - __bind(__bind&& __b) - : __f_(_VSTD::move(__b.__f_)), - __bound_args_(_VSTD::move(__b.__bound_args_)) {} - - _LIBCPP_INLINE_VISIBILITY - __bind& operator=(__bind&& __b) - { - __f_ = _VSTD::move(__b.__f_); - __bound_args_ = _VSTD::move(__b.__bound_args_); - return *this; - } - -#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS - template <class _Gp, class ..._BA, class = typename enable_if < @@ -2278,31 +2274,6 @@ class __bind_r public: typedef _Rp result_type; -#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS - - _LIBCPP_INLINE_VISIBILITY - __bind_r(const __bind_r& __b) - : base(_VSTD::forward<const base&>(__b)) {} - - _LIBCPP_INLINE_VISIBILITY - __bind_r& operator=(const __bind_r& __b) - { - base::operator=(_VSTD::forward<const base&>(__b)); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - __bind_r(__bind_r&& __b) - : base(_VSTD::forward<base>(__b)) {} - - _LIBCPP_INLINE_VISIBILITY - __bind_r& operator=(__bind_r&& __b) - { - base::operator=(_VSTD::forward<base>(__b)); - return *this; - } - -#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS template <class _Gp, class ..._BA, class = typename enable_if @@ -2369,7 +2340,7 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args) #endif // _LIBCPP_HAS_NO_VARIADICS template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<bool> +struct _LIBCPP_TEMPLATE_VIS hash<bool> : public unary_function<bool, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2377,7 +2348,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<bool> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<char> +struct _LIBCPP_TEMPLATE_VIS hash<char> : public unary_function<char, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2385,7 +2356,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<char> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<signed char> +struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public unary_function<signed char, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2393,7 +2364,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<signed char> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned char> +struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public unary_function<unsigned char, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2403,7 +2374,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned char> #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<char16_t> +struct _LIBCPP_TEMPLATE_VIS hash<char16_t> : public unary_function<char16_t, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2411,7 +2382,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<char16_t> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<char32_t> +struct _LIBCPP_TEMPLATE_VIS hash<char32_t> : public unary_function<char32_t, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2421,7 +2392,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<char32_t> #endif // _LIBCPP_HAS_NO_UNICODE_CHARS template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<wchar_t> +struct _LIBCPP_TEMPLATE_VIS hash<wchar_t> : public unary_function<wchar_t, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2429,7 +2400,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<wchar_t> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<short> +struct _LIBCPP_TEMPLATE_VIS hash<short> : public unary_function<short, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2437,7 +2408,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<short> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned short> +struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public unary_function<unsigned short, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2445,7 +2416,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned short> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<int> +struct _LIBCPP_TEMPLATE_VIS hash<int> : public unary_function<int, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2453,7 +2424,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<int> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned int> +struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public unary_function<unsigned int, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2461,7 +2432,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned int> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<long> +struct _LIBCPP_TEMPLATE_VIS hash<long> : public unary_function<long, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2469,7 +2440,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<long> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long> +struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public unary_function<unsigned long, size_t> { _LIBCPP_INLINE_VISIBILITY @@ -2477,13 +2448,13 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<long long> +struct _LIBCPP_TEMPLATE_VIS hash<long long> : public __scalar_hash<long long> { }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long long> +struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long> : public __scalar_hash<unsigned long long> { }; @@ -2491,13 +2462,13 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long long> #ifndef _LIBCPP_HAS_NO_INT128 template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<__int128_t> +struct _LIBCPP_TEMPLATE_VIS hash<__int128_t> : public __scalar_hash<__int128_t> { }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<__uint128_t> +struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t> : public __scalar_hash<__uint128_t> { }; @@ -2505,7 +2476,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<__uint128_t> #endif template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<float> +struct _LIBCPP_TEMPLATE_VIS hash<float> : public __scalar_hash<float> { _LIBCPP_INLINE_VISIBILITY @@ -2519,7 +2490,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<float> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<double> +struct _LIBCPP_TEMPLATE_VIS hash<double> : public __scalar_hash<double> { _LIBCPP_INLINE_VISIBILITY @@ -2533,7 +2504,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<double> }; template <> -struct _LIBCPP_TYPE_VIS_ONLY hash<long double> +struct _LIBCPP_TEMPLATE_VIS hash<long double> : public __scalar_hash<long double> { _LIBCPP_INLINE_VISIBILITY @@ -2583,12 +2554,11 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<long double> }; #if _LIBCPP_STD_VER > 11 -template <class _Tp> -struct _LIBCPP_TYPE_VIS_ONLY hash + +template <class _Tp, bool = is_enum<_Tp>::value> +struct _LIBCPP_TEMPLATE_VIS __enum_hash : public unary_function<_Tp, size_t> { - static_assert(is_enum<_Tp>::value, "This hash only works for enumeration types"); - _LIBCPP_INLINE_VISIBILITY size_t operator()(_Tp __v) const _NOEXCEPT { @@ -2596,11 +2566,24 @@ struct _LIBCPP_TYPE_VIS_ONLY hash return hash<type>{}(static_cast<type>(__v)); } }; +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> { + __enum_hash() = delete; + __enum_hash(__enum_hash const&) = delete; + __enum_hash& operator=(__enum_hash const&) = delete; +}; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp> +{ +}; #endif #if _LIBCPP_STD_VER > 14 +#define __cpp_lib_invoke 201411 + template <class _Fn, class ..._Args> result_of_t<_Fn&&(_Args&&...)> invoke(_Fn&& __f, _Args&&... __args) @@ -2610,7 +2593,7 @@ invoke(_Fn&& __f, _Args&&... __args) } template <class _DecayFunc> -class _LIBCPP_TYPE_VIS_ONLY __not_fn_imp { +class _LIBCPP_TEMPLATE_VIS __not_fn_imp { _DecayFunc __fd; public: @@ -2620,30 +2603,30 @@ public: _LIBCPP_INLINE_VISIBILITY auto operator()(_Args&& ...__args) & noexcept(noexcept(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...))) - -> decltype(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...)) - { return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...); } + -> decltype( !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...)) + { return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...); } template <class ..._Args> _LIBCPP_INLINE_VISIBILITY auto operator()(_Args&& ...__args) && noexcept(noexcept(!_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...))) - -> decltype(!_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...)) - { return !_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...); } + -> decltype( !_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...)) + { return !_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...); } template <class ..._Args> _LIBCPP_INLINE_VISIBILITY auto operator()(_Args&& ...__args) const& noexcept(noexcept(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...))) - -> decltype(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...)) - { return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...); } + -> decltype( !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...)) + { return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...); } template <class ..._Args> _LIBCPP_INLINE_VISIBILITY auto operator()(_Args&& ...__args) const&& noexcept(noexcept(!_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...))) - -> decltype(!_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...)) - { return !_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...); } + -> decltype( !_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...)) + { return !_VSTD::invoke(_VSTD::move(__fd), _VSTD::forward<_Args>(__args)...); } private: template <class _RawFunc, |