mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-03 19:22:27 +00:00
Release Cosmopolitan v3.6.0
This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
59
third_party/libcxx/__functional/bind_back.h
vendored
59
third_party/libcxx/__functional/bind_back.h
vendored
|
@ -29,33 +29,52 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
template <size_t _NBound, class = make_index_sequence<_NBound>>
|
||||
struct __bind_back_op;
|
||||
|
||||
template <size_t _NBound, size_t ..._Ip>
|
||||
template <size_t _NBound, size_t... _Ip>
|
||||
struct __bind_back_op<_NBound, index_sequence<_Ip...>> {
|
||||
template <class _Fn, class _BoundArgs, class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f, _BoundArgs&& __bound_args, _Args&&... __args) const
|
||||
noexcept(noexcept(_VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_BoundArgs>(__bound_args))...)))
|
||||
-> decltype( _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_BoundArgs>(__bound_args))...))
|
||||
{ return _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_BoundArgs>(__bound_args))...); }
|
||||
template <class _Fn, class _BoundArgs, class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f, _BoundArgs&& __bound_args, _Args&&... __args) const
|
||||
noexcept(noexcept(std::invoke(std::forward<_Fn>(__f),
|
||||
std::forward<_Args>(__args)...,
|
||||
std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)))
|
||||
-> decltype(std::invoke(std::forward<_Fn>(__f),
|
||||
std::forward<_Args>(__args)...,
|
||||
std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)) {
|
||||
return std::invoke(std::forward<_Fn>(__f),
|
||||
std::forward<_Args>(__args)...,
|
||||
std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Fn, class _BoundArgs>
|
||||
struct __bind_back_t : __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs> {
|
||||
using __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs>::__perfect_forward;
|
||||
using __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs>::__perfect_forward;
|
||||
};
|
||||
|
||||
template <class _Fn, class ..._Args, class = enable_if_t<
|
||||
_And<
|
||||
is_constructible<decay_t<_Fn>, _Fn>,
|
||||
is_move_constructible<decay_t<_Fn>>,
|
||||
is_constructible<decay_t<_Args>, _Args>...,
|
||||
is_move_constructible<decay_t<_Args>>...
|
||||
>::value
|
||||
>>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
constexpr auto __bind_back(_Fn&& __f, _Args&&... __args)
|
||||
noexcept(noexcept(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(_VSTD::forward<_Fn>(__f), _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...))))
|
||||
-> decltype( __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(_VSTD::forward<_Fn>(__f), _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)))
|
||||
{ return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(_VSTD::forward<_Fn>(__f), _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); }
|
||||
template <class _Fn, class... _Args>
|
||||
requires is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> &&
|
||||
(is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto __bind_back(_Fn&& __f, _Args&&... __args) noexcept(
|
||||
noexcept(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
|
||||
std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))))
|
||||
-> decltype(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
|
||||
std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))) {
|
||||
return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
|
||||
std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...));
|
||||
}
|
||||
|
||||
# if _LIBCPP_STD_VER >= 23
|
||||
template <class _Fn, class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto bind_back(_Fn&& __f, _Args&&... __args) {
|
||||
static_assert(is_constructible_v<decay_t<_Fn>, _Fn>, "bind_back requires decay_t<F> to be constructible from F");
|
||||
static_assert(is_move_constructible_v<decay_t<_Fn>>, "bind_back requires decay_t<F> to be move constructible");
|
||||
static_assert((is_constructible_v<decay_t<_Args>, _Args> && ...),
|
||||
"bind_back requires all decay_t<Args> to be constructible from respective Args");
|
||||
static_assert((is_move_constructible_v<decay_t<_Args>> && ...),
|
||||
"bind_back requires all decay_t<Args> to be move constructible");
|
||||
return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
|
||||
std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...));
|
||||
}
|
||||
# endif // _LIBCPP_STD_VER >= 23
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 20
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue