diff options
author | mikhnenko <[email protected]> | 2025-04-19 17:15:47 +0300 |
---|---|---|
committer | mikhnenko <[email protected]> | 2025-04-19 17:32:41 +0300 |
commit | 8a4ae1910b2babbc014f5d5ff97c2245803d6d1a (patch) | |
tree | 9c8728b4ad4226ef084d46a6d6cde7b5ae46e4d5 /contrib/libs/cxxsupp/libcxx/include/__functional/function.h | |
parent | 605a8a3075d2116bf0c742d7ae889ba14b801a8e (diff) |
Update libcxx to 20 Sep 2024
TRIVIAL
commit_hash:04d8ae0a53854a1ed8cdea2e191c8dfa1248c023
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__functional/function.h')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/__functional/function.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h index c7b98035e34..0d95c9a6ef2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h @@ -78,7 +78,7 @@ public: }; _LIBCPP_DIAGNOSTIC_POP -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_function_call(); # else @@ -143,45 +143,46 @@ class __default_alloc_func; template <class _Fp, class _Ap, class _Rp, class... _ArgTypes> class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> { - __compressed_pair<_Fp, _Ap> __f_; + _LIBCPP_COMPRESSED_PAIR(_Fp, __func_, _Ap, __alloc_); public: typedef _LIBCPP_NODEBUG _Fp _Target; typedef _LIBCPP_NODEBUG _Ap _Alloc; - _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_.first(); } + _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __func_; } // WIN32 APIs may define __allocator, so use __get_allocator instead. - _LIBCPP_HIDE_FROM_ABI const _Alloc& __get_allocator() const { return __f_.second(); } + _LIBCPP_HIDE_FROM_ABI const _Alloc& __get_allocator() const { return __alloc_; } - _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f) - : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple()) {} + _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f) : __func_(std::move(__f)), __alloc_() {} - _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, const _Alloc& __a) - : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(__a)) {} + _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, const _Alloc& __a) : __func_(__f), __alloc_(__a) {} _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, _Alloc&& __a) - : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(std::move(__a))) {} + : __func_(__f), __alloc_(std::move(__a)) {} _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f, _Alloc&& __a) - : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple(std::move(__a))) {} + : __func_(std::move(__f)), __alloc_(std::move(__a)) {} _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __arg) { typedef __invoke_void_return_wrapper<_Rp> _Invoker; - return _Invoker::__call(__f_.first(), std::forward<_ArgTypes>(__arg)...); + return _Invoker::__call(__func_, std::forward<_ArgTypes>(__arg)...); } _LIBCPP_HIDE_FROM_ABI __alloc_func* __clone() const { typedef allocator_traits<_Alloc> __alloc_traits; typedef __rebind_alloc<__alloc_traits, __alloc_func> _AA; - _AA __a(__f_.second()); + _AA __a(__alloc_); typedef __allocator_destructor<_AA> _Dp; unique_ptr<__alloc_func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new ((void*)__hold.get()) __alloc_func(__f_.first(), _Alloc(__a)); + ::new ((void*)__hold.get()) __alloc_func(__func_, _Alloc(__a)); return __hold.release(); } - _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); } + _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { + __func_.~_Fp(); + __alloc_.~_Alloc(); + } _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__alloc_func* __f) { typedef allocator_traits<_Alloc> __alloc_traits; |