mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +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
|
@ -21,20 +21,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function
|
||||
{
|
||||
typedef _Arg1 first_argument_type;
|
||||
typedef _Arg2 second_argument_type;
|
||||
typedef _Result result_type;
|
||||
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function {
|
||||
typedef _Arg1 first_argument_type;
|
||||
typedef _Arg2 second_argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result> struct __binary_function_keep_layout_base {
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct __binary_function_keep_layout_base {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1;
|
||||
using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1;
|
||||
using second_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg2;
|
||||
using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
|
||||
using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
27
third_party/libcxx/__functional/binary_negate.h
vendored
27
third_party/libcxx/__functional/binary_negate.h
vendored
|
@ -25,23 +25,24 @@ template <class _Predicate>
|
|||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate
|
||||
: public __binary_function<typename _Predicate::first_argument_type,
|
||||
typename _Predicate::second_argument_type,
|
||||
bool>
|
||||
{
|
||||
_Predicate __pred_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
binary_negate(const _Predicate& __pred) : __pred_(__pred) {}
|
||||
bool> {
|
||||
_Predicate __pred_;
|
||||
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Predicate::first_argument_type& __x,
|
||||
const typename _Predicate::second_argument_type& __y) const
|
||||
{return !__pred_(__x, __y);}
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX14 binary_negate(const _Predicate& __pred)
|
||||
: __pred_(__pred) {}
|
||||
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(
|
||||
const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const {
|
||||
return !__pred_(__x, __y);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Predicate>
|
||||
_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
|
||||
binary_negate<_Predicate>
|
||||
not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
|
||||
_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI binary_negate<_Predicate>
|
||||
not2(const _Predicate& __pred) {
|
||||
return binary_negate<_Predicate>(__pred);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
|
||||
|
||||
|
|
418
third_party/libcxx/__functional/bind.h
vendored
418
third_party/libcxx/__functional/bind.h
vendored
|
@ -13,6 +13,7 @@
|
|||
#include <__config>
|
||||
#include <__functional/invoke.h>
|
||||
#include <__functional/weak_result_type.h>
|
||||
#include <__fwd/functional.h>
|
||||
#include <__type_traits/decay.h>
|
||||
#include <__type_traits/is_reference_wrapper.h>
|
||||
#include <__type_traits/is_void.h>
|
||||
|
@ -25,34 +26,30 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _Tp>
|
||||
struct is_bind_expression : _If<
|
||||
_IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
|
||||
false_type,
|
||||
is_bind_expression<__remove_cvref_t<_Tp> >
|
||||
> {};
|
||||
template <class _Tp>
|
||||
struct is_bind_expression
|
||||
: _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, false_type, is_bind_expression<__remove_cvref_t<_Tp> > > {};
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
template <class _Tp>
|
||||
inline constexpr bool is_bind_expression_v = is_bind_expression<_Tp>::value;
|
||||
#endif
|
||||
|
||||
template<class _Tp>
|
||||
struct is_placeholder : _If<
|
||||
_IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
|
||||
integral_constant<int, 0>,
|
||||
is_placeholder<__remove_cvref_t<_Tp> >
|
||||
> {};
|
||||
template <class _Tp>
|
||||
struct is_placeholder
|
||||
: _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
|
||||
integral_constant<int, 0>,
|
||||
is_placeholder<__remove_cvref_t<_Tp> > > {};
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
template <class _Tp>
|
||||
inline constexpr int is_placeholder_v = is_placeholder<_Tp>::value;
|
||||
#endif
|
||||
|
||||
namespace placeholders
|
||||
{
|
||||
namespace placeholders {
|
||||
|
||||
template <int _Np> struct __ph {};
|
||||
template <int _Np>
|
||||
struct __ph {};
|
||||
|
||||
// C++17 recommends that we implement placeholders as `inline constexpr`, but allows
|
||||
// implementing them as `extern <implementation-defined>`. Libc++ implements them as
|
||||
|
@ -62,321 +59,234 @@ template <int _Np> struct __ph {};
|
|||
//
|
||||
// In practice, since placeholders are empty, `extern const` is almost impossible
|
||||
// to distinguish from `inline constexpr` from a usage stand point.
|
||||
_LIBCPP_FUNC_VIS extern const __ph<1> _1;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<2> _2;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<3> _3;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<4> _4;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<5> _5;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<6> _6;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<7> _7;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<8> _8;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<9> _9;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<10> _10;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<1> _1;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<2> _2;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<3> _3;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<4> _4;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<5> _5;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<6> _6;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<7> _7;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<8> _8;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<9> _9;
|
||||
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<10> _10;
|
||||
|
||||
} // namespace placeholders
|
||||
|
||||
template<int _Np>
|
||||
struct is_placeholder<placeholders::__ph<_Np> >
|
||||
: public integral_constant<int, _Np> {};
|
||||
|
||||
template <int _Np>
|
||||
struct is_placeholder<placeholders::__ph<_Np> > : public integral_constant<int, _Np> {};
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Uj>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_Tp&
|
||||
__mu(reference_wrapper<_Tp> __t, _Uj&)
|
||||
{
|
||||
return __t.get();
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& __mu(reference_wrapper<_Tp> __t, _Uj&) {
|
||||
return __t.get();
|
||||
}
|
||||
|
||||
template <class _Ti, class ..._Uj, size_t ..._Indx>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename __invoke_of<_Ti&, _Uj...>::type
|
||||
__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)
|
||||
{
|
||||
return __ti(_VSTD::forward<_Uj>(_VSTD::get<_Indx>(__uj))...);
|
||||
template <class _Ti, class... _Uj, size_t... _Indx>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<_Ti&, _Uj...>::type
|
||||
__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) {
|
||||
return __ti(std::forward<_Uj>(std::get<_Indx>(__uj))...);
|
||||
}
|
||||
|
||||
template <class _Ti, class ..._Uj>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename __enable_if_t
|
||||
<
|
||||
is_bind_expression<_Ti>::value,
|
||||
__invoke_of<_Ti&, _Uj...>
|
||||
>::type
|
||||
__mu(_Ti& __ti, tuple<_Uj...>& __uj)
|
||||
{
|
||||
typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
|
||||
return _VSTD::__mu_expand(__ti, __uj, __indices());
|
||||
template <class _Ti, class... _Uj, __enable_if_t<is_bind_expression<_Ti>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<_Ti&, _Uj...>::type
|
||||
__mu(_Ti& __ti, tuple<_Uj...>& __uj) {
|
||||
typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
|
||||
return std::__mu_expand(__ti, __uj, __indices());
|
||||
}
|
||||
|
||||
template <bool IsPh, class _Ti, class _Uj>
|
||||
template <bool _IsPh, class _Ti, class _Uj>
|
||||
struct __mu_return2 {};
|
||||
|
||||
template <class _Ti, class _Uj>
|
||||
struct __mu_return2<true, _Ti, _Uj>
|
||||
{
|
||||
typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
|
||||
struct __mu_return2<true, _Ti, _Uj> {
|
||||
typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
|
||||
};
|
||||
|
||||
template <class _Ti, class _Uj>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename enable_if
|
||||
<
|
||||
0 < is_placeholder<_Ti>::value,
|
||||
typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
|
||||
>::type
|
||||
__mu(_Ti&, _Uj& __uj)
|
||||
{
|
||||
const size_t __indx = is_placeholder<_Ti>::value - 1;
|
||||
return _VSTD::forward<typename tuple_element<__indx, _Uj>::type>(_VSTD::get<__indx>(__uj));
|
||||
template <class _Ti, class _Uj, __enable_if_t<0 < is_placeholder<_Ti>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
|
||||
__mu(_Ti&, _Uj& __uj) {
|
||||
const size_t __indx = is_placeholder<_Ti>::value - 1;
|
||||
return std::forward<typename tuple_element<__indx, _Uj>::type>(std::get<__indx>(__uj));
|
||||
}
|
||||
|
||||
template <class _Ti, class _Uj>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename enable_if
|
||||
<
|
||||
!is_bind_expression<_Ti>::value &&
|
||||
is_placeholder<_Ti>::value == 0 &&
|
||||
!__is_reference_wrapper<_Ti>::value,
|
||||
_Ti&
|
||||
>::type
|
||||
__mu(_Ti& __ti, _Uj&)
|
||||
{
|
||||
return __ti;
|
||||
template <class _Ti,
|
||||
class _Uj,
|
||||
__enable_if_t<!is_bind_expression<_Ti>::value && is_placeholder<_Ti>::value == 0 &&
|
||||
!__is_reference_wrapper<_Ti>::value,
|
||||
int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Ti& __mu(_Ti& __ti, _Uj&) {
|
||||
return __ti;
|
||||
}
|
||||
|
||||
template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh,
|
||||
class _TupleUj>
|
||||
template <class _Ti, bool _IsReferenceWrapper, bool _IsBindEx, bool _IsPh, class _TupleUj>
|
||||
struct __mu_return_impl;
|
||||
|
||||
template <bool _Invokable, class _Ti, class ..._Uj>
|
||||
struct __mu_return_invokable // false
|
||||
template <bool _Invokable, class _Ti, class... _Uj>
|
||||
struct __mu_return_invokable // false
|
||||
{
|
||||
typedef __nat type;
|
||||
typedef __nat type;
|
||||
};
|
||||
|
||||
template <class _Ti, class ..._Uj>
|
||||
struct __mu_return_invokable<true, _Ti, _Uj...>
|
||||
{
|
||||
typedef typename __invoke_of<_Ti&, _Uj...>::type type;
|
||||
template <class _Ti, class... _Uj>
|
||||
struct __mu_return_invokable<true, _Ti, _Uj...> {
|
||||
typedef typename __invoke_of<_Ti&, _Uj...>::type type;
|
||||
};
|
||||
|
||||
template <class _Ti, class ..._Uj>
|
||||
template <class _Ti, class... _Uj>
|
||||
struct __mu_return_impl<_Ti, false, true, false, tuple<_Uj...> >
|
||||
: public __mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...>
|
||||
{
|
||||
: public __mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...> {};
|
||||
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct __mu_return_impl<_Ti, false, false, true, _TupleUj> {
|
||||
typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _TupleUj>::type&& type;
|
||||
};
|
||||
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct __mu_return_impl<_Ti, false, false, true, _TupleUj>
|
||||
{
|
||||
typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
|
||||
_TupleUj>::type&& type;
|
||||
struct __mu_return_impl<_Ti, true, false, false, _TupleUj> {
|
||||
typedef typename _Ti::type& type;
|
||||
};
|
||||
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct __mu_return_impl<_Ti, true, false, false, _TupleUj>
|
||||
{
|
||||
typedef typename _Ti::type& type;
|
||||
};
|
||||
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct __mu_return_impl<_Ti, false, false, false, _TupleUj>
|
||||
{
|
||||
typedef _Ti& type;
|
||||
struct __mu_return_impl<_Ti, false, false, false, _TupleUj> {
|
||||
typedef _Ti& type;
|
||||
};
|
||||
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct __mu_return
|
||||
: public __mu_return_impl<_Ti,
|
||||
__is_reference_wrapper<_Ti>::value,
|
||||
is_bind_expression<_Ti>::value,
|
||||
0 < is_placeholder<_Ti>::value &&
|
||||
is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value,
|
||||
_TupleUj>
|
||||
{
|
||||
};
|
||||
: public __mu_return_impl<
|
||||
_Ti,
|
||||
__is_reference_wrapper<_Ti>::value,
|
||||
is_bind_expression<_Ti>::value,
|
||||
0 < is_placeholder<_Ti>::value && is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value,
|
||||
_TupleUj> {};
|
||||
|
||||
template <class _Fp, class _BoundArgs, class _TupleUj>
|
||||
struct __is_valid_bind_return
|
||||
{
|
||||
static const bool value = false;
|
||||
struct __is_valid_bind_return {
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _Fp, class ..._BoundArgs, class _TupleUj>
|
||||
struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
|
||||
{
|
||||
static const bool value = __invokable<_Fp,
|
||||
typename __mu_return<_BoundArgs, _TupleUj>::type...>::value;
|
||||
template <class _Fp, class... _BoundArgs, class _TupleUj>
|
||||
struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj> {
|
||||
static const bool value = __invokable<_Fp, typename __mu_return<_BoundArgs, _TupleUj>::type...>::value;
|
||||
};
|
||||
|
||||
template <class _Fp, class ..._BoundArgs, class _TupleUj>
|
||||
struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
|
||||
{
|
||||
static const bool value = __invokable<_Fp,
|
||||
typename __mu_return<const _BoundArgs, _TupleUj>::type...>::value;
|
||||
template <class _Fp, class... _BoundArgs, class _TupleUj>
|
||||
struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj> {
|
||||
static const bool value = __invokable<_Fp, typename __mu_return<const _BoundArgs, _TupleUj>::type...>::value;
|
||||
};
|
||||
|
||||
template <class _Fp, class _BoundArgs, class _TupleUj,
|
||||
bool = __is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
|
||||
template <class _Fp, class _BoundArgs, class _TupleUj, bool = __is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
|
||||
struct __bind_return;
|
||||
|
||||
template <class _Fp, class ..._BoundArgs, class _TupleUj>
|
||||
struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true>
|
||||
{
|
||||
typedef typename __invoke_of
|
||||
<
|
||||
_Fp&,
|
||||
typename __mu_return
|
||||
<
|
||||
_BoundArgs,
|
||||
_TupleUj
|
||||
>::type...
|
||||
>::type type;
|
||||
template <class _Fp, class... _BoundArgs, class _TupleUj>
|
||||
struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true> {
|
||||
typedef typename __invoke_of< _Fp&, typename __mu_return< _BoundArgs, _TupleUj >::type... >::type type;
|
||||
};
|
||||
|
||||
template <class _Fp, class ..._BoundArgs, class _TupleUj>
|
||||
struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true>
|
||||
{
|
||||
typedef typename __invoke_of
|
||||
<
|
||||
_Fp&,
|
||||
typename __mu_return
|
||||
<
|
||||
const _BoundArgs,
|
||||
_TupleUj
|
||||
>::type...
|
||||
>::type type;
|
||||
template <class _Fp, class... _BoundArgs, class _TupleUj>
|
||||
struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true> {
|
||||
typedef typename __invoke_of< _Fp&, typename __mu_return< const _BoundArgs, _TupleUj >::type... >::type type;
|
||||
};
|
||||
|
||||
template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename __bind_return<_Fp, _BoundArgs, _Args>::type
|
||||
__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
|
||||
_Args&& __args)
|
||||
{
|
||||
return _VSTD::__invoke(__f, _VSTD::__mu(_VSTD::get<_Indx>(__bound_args), __args)...);
|
||||
template <class _Fp, class _BoundArgs, size_t... _Indx, class _Args>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fp, _BoundArgs, _Args>::type
|
||||
__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) {
|
||||
return std::__invoke(__f, std::__mu(std::get<_Indx>(__bound_args), __args)...);
|
||||
}
|
||||
|
||||
template<class _Fp, class ..._BoundArgs>
|
||||
class __bind : public __weak_result_type<__decay_t<_Fp> >
|
||||
{
|
||||
template <class _Fp, class... _BoundArgs>
|
||||
class __bind : public __weak_result_type<__decay_t<_Fp> > {
|
||||
protected:
|
||||
using _Fd = __decay_t<_Fp>;
|
||||
typedef tuple<__decay_t<_BoundArgs>...> _Td;
|
||||
using _Fd = __decay_t<_Fp>;
|
||||
typedef tuple<__decay_t<_BoundArgs>...> _Td;
|
||||
|
||||
private:
|
||||
_Fd __f_;
|
||||
_Td __bound_args_;
|
||||
_Fd __f_;
|
||||
_Td __bound_args_;
|
||||
|
||||
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
|
||||
|
||||
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
|
||||
public:
|
||||
template <class _Gp, class ..._BA,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<_Fd, _Gp>::value &&
|
||||
!is_same<__libcpp_remove_reference_t<_Gp>,
|
||||
__bind>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
|
||||
: __f_(_VSTD::forward<_Gp>(__f)),
|
||||
__bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
|
||||
template <
|
||||
class _Gp,
|
||||
class... _BA,
|
||||
__enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bind(_Gp&& __f, _BA&&... __bound_args)
|
||||
: __f_(std::forward<_Gp>(__f)), __bound_args_(std::forward<_BA>(__bound_args)...) {}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
return _VSTD::__apply_functor(__f_, __bound_args_, __indices(),
|
||||
tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
|
||||
operator()(_Args&&... __args) {
|
||||
return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
|
||||
}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
|
||||
operator()(_Args&& ...__args) const
|
||||
{
|
||||
return _VSTD::__apply_functor(__f_, __bound_args_, __indices(),
|
||||
tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
|
||||
operator()(_Args&&... __args) const {
|
||||
return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
|
||||
}
|
||||
};
|
||||
|
||||
template<class _Fp, class ..._BoundArgs>
|
||||
template <class _Fp, class... _BoundArgs>
|
||||
struct is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
|
||||
|
||||
template<class _Rp, class _Fp, class ..._BoundArgs>
|
||||
class __bind_r
|
||||
: public __bind<_Fp, _BoundArgs...>
|
||||
{
|
||||
typedef __bind<_Fp, _BoundArgs...> base;
|
||||
typedef typename base::_Fd _Fd;
|
||||
typedef typename base::_Td _Td;
|
||||
template <class _Rp, class _Fp, class... _BoundArgs>
|
||||
class __bind_r : public __bind<_Fp, _BoundArgs...> {
|
||||
typedef __bind<_Fp, _BoundArgs...> base;
|
||||
typedef typename base::_Fd _Fd;
|
||||
typedef typename base::_Td _Td;
|
||||
|
||||
public:
|
||||
typedef _Rp result_type;
|
||||
typedef _Rp result_type;
|
||||
|
||||
template <
|
||||
class _Gp,
|
||||
class... _BA,
|
||||
__enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind_r>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bind_r(_Gp&& __f, _BA&&... __bound_args)
|
||||
: base(std::forward<_Gp>(__f), std::forward<_BA>(__bound_args)...) {}
|
||||
|
||||
template <class _Gp, class ..._BA,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<_Fd, _Gp>::value &&
|
||||
!is_same<__libcpp_remove_reference_t<_Gp>,
|
||||
__bind_r>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
|
||||
: base(_VSTD::forward<_Gp>(__f),
|
||||
_VSTD::forward<_BA>(__bound_args)...) {}
|
||||
template <
|
||||
class... _Args,
|
||||
__enable_if_t<is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type, result_type>::value ||
|
||||
is_void<_Rp>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 result_type operator()(_Args&&... __args) {
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(static_cast<base&>(*this), std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type,
|
||||
result_type>::value || is_void<_Rp>::value,
|
||||
result_type
|
||||
>::type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
|
||||
result_type>::value || is_void<_Rp>::value,
|
||||
result_type
|
||||
>::type
|
||||
operator()(_Args&& ...__args) const
|
||||
{
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
template <class... _Args,
|
||||
__enable_if_t<is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
|
||||
result_type>::value ||
|
||||
is_void<_Rp>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 result_type operator()(_Args&&... __args) const {
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(static_cast<base const&>(*this), std::forward<_Args>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _Rp, class _Fp, class ..._BoundArgs>
|
||||
template <class _Rp, class _Fp, class... _BoundArgs>
|
||||
struct is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
|
||||
|
||||
template<class _Fp, class ..._BoundArgs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
__bind<_Fp, _BoundArgs...>
|
||||
bind(_Fp&& __f, _BoundArgs&&... __bound_args)
|
||||
{
|
||||
typedef __bind<_Fp, _BoundArgs...> type;
|
||||
return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
|
||||
template <class _Fp, class... _BoundArgs>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind<_Fp, _BoundArgs...>
|
||||
bind(_Fp&& __f, _BoundArgs&&... __bound_args) {
|
||||
typedef __bind<_Fp, _BoundArgs...> type;
|
||||
return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
|
||||
}
|
||||
|
||||
template<class _Rp, class _Fp, class ..._BoundArgs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
__bind_r<_Rp, _Fp, _BoundArgs...>
|
||||
bind(_Fp&& __f, _BoundArgs&&... __bound_args)
|
||||
{
|
||||
typedef __bind_r<_Rp, _Fp, _BoundArgs...> type;
|
||||
return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
|
||||
template <class _Rp, class _Fp, class... _BoundArgs>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind_r<_Rp, _Fp, _BoundArgs...>
|
||||
bind(_Fp&& __f, _BoundArgs&&... __bound_args) {
|
||||
typedef __bind_r<_Rp, _Fp, _BoundArgs...> type;
|
||||
return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
|
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
|
||||
|
||||
|
|
32
third_party/libcxx/__functional/bind_front.h
vendored
32
third_party/libcxx/__functional/bind_front.h
vendored
|
@ -17,7 +17,6 @@
|
|||
#include <__type_traits/decay.h>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/is_constructible.h>
|
||||
#include <__type_traits/is_move_constructible.h>
|
||||
#include <__utility/forward.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
@ -29,30 +28,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER >= 20
|
||||
|
||||
struct __bind_front_op {
|
||||
template <class ..._Args>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
constexpr auto operator()(_Args&& ...__args) const
|
||||
noexcept(noexcept(_VSTD::invoke(_VSTD::forward<_Args>(__args)...)))
|
||||
-> decltype( _VSTD::invoke(_VSTD::forward<_Args>(__args)...))
|
||||
{ return _VSTD::invoke(_VSTD::forward<_Args>(__args)...); }
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const noexcept(
|
||||
noexcept(std::invoke(std::forward<_Args>(__args)...))) -> decltype(std::invoke(std::forward<_Args>(__args)...)) {
|
||||
return std::invoke(std::forward<_Args>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Fn, class ..._BoundArgs>
|
||||
template <class _Fn, class... _BoundArgs>
|
||||
struct __bind_front_t : __perfect_forward<__bind_front_op, _Fn, _BoundArgs...> {
|
||||
using __perfect_forward<__bind_front_op, _Fn, _BoundArgs...>::__perfect_forward;
|
||||
using __perfect_forward<__bind_front_op, _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_front(_Fn&& __f, _Args&&... __args) {
|
||||
return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(_VSTD::forward<_Fn>(__f), _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_front(_Fn&& __f, _Args&&... __args) {
|
||||
return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 20
|
||||
|
|
39
third_party/libcxx/__functional/binder1st.h
vendored
39
third_party/libcxx/__functional/binder1st.h
vendored
|
@ -21,30 +21,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
|
||||
template <class __Operation>
|
||||
template <class _Operation>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st
|
||||
: public __unary_function<typename __Operation::second_argument_type, typename __Operation::result_type>
|
||||
{
|
||||
: public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> {
|
||||
protected:
|
||||
__Operation op;
|
||||
typename __Operation::first_argument_type value;
|
||||
_Operation op;
|
||||
typename _Operation::first_argument_type value;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY binder1st(const __Operation& __x,
|
||||
const typename __Operation::first_argument_type __y)
|
||||
: op(__x), value(__y) {}
|
||||
_LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
|
||||
(typename __Operation::second_argument_type& __x) const
|
||||
{return op(value, __x);}
|
||||
_LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
|
||||
(const typename __Operation::second_argument_type& __x) const
|
||||
{return op(value, __x);}
|
||||
_LIBCPP_HIDE_FROM_ABI binder1st(const _Operation& __x, const typename _Operation::first_argument_type __y)
|
||||
: op(__x), value(__y) {}
|
||||
_LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
|
||||
operator()(typename _Operation::second_argument_type& __x) const {
|
||||
return op(value, __x);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
|
||||
operator()(const typename _Operation::second_argument_type& __x) const {
|
||||
return op(value, __x);
|
||||
}
|
||||
};
|
||||
|
||||
template <class __Operation, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
binder1st<__Operation>
|
||||
bind1st(const __Operation& __op, const _Tp& __x)
|
||||
{return binder1st<__Operation>(__op, __x);}
|
||||
template <class _Operation, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI binder1st<_Operation>
|
||||
bind1st(const _Operation& __op, const _Tp& __x) {
|
||||
return binder1st<_Operation>(__op, __x);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
|
||||
|
|
39
third_party/libcxx/__functional/binder2nd.h
vendored
39
third_party/libcxx/__functional/binder2nd.h
vendored
|
@ -21,30 +21,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
|
||||
template <class __Operation>
|
||||
template <class _Operation>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd
|
||||
: public __unary_function<typename __Operation::first_argument_type, typename __Operation::result_type>
|
||||
{
|
||||
: public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type> {
|
||||
protected:
|
||||
__Operation op;
|
||||
typename __Operation::second_argument_type value;
|
||||
_Operation op;
|
||||
typename _Operation::second_argument_type value;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
binder2nd(const __Operation& __x, const typename __Operation::second_argument_type __y)
|
||||
: op(__x), value(__y) {}
|
||||
_LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
|
||||
( typename __Operation::first_argument_type& __x) const
|
||||
{return op(__x, value);}
|
||||
_LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
|
||||
(const typename __Operation::first_argument_type& __x) const
|
||||
{return op(__x, value);}
|
||||
_LIBCPP_HIDE_FROM_ABI binder2nd(const _Operation& __x, const typename _Operation::second_argument_type __y)
|
||||
: op(__x), value(__y) {}
|
||||
_LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
|
||||
operator()(typename _Operation::first_argument_type& __x) const {
|
||||
return op(__x, value);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
|
||||
operator()(const typename _Operation::first_argument_type& __x) const {
|
||||
return op(__x, value);
|
||||
}
|
||||
};
|
||||
|
||||
template <class __Operation, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
binder2nd<__Operation>
|
||||
bind2nd(const __Operation& __op, const _Tp& __x)
|
||||
{return binder2nd<__Operation>(__op, __x);}
|
||||
template <class _Operation, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI binder2nd<_Operation>
|
||||
bind2nd(const _Operation& __op, const _Tp& __x) {
|
||||
return binder2nd<_Operation>(__op, __x);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
#ifndef _LIBCPP___FUNCTIONAL_BOYER_MOORE_SEARCHER_H
|
||||
#define _LIBCPP___FUNCTIONAL_BOYER_MOORE_SEARCHER_H
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <__algorithm/fill_n.h>
|
||||
#include <__config>
|
||||
#include <__functional/hash.h>
|
||||
|
@ -25,39 +29,29 @@
|
|||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
# include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Key,
|
||||
class _Value,
|
||||
class _Hash,
|
||||
class _BinaryPredicate,
|
||||
bool /*useArray*/>
|
||||
template <class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/>
|
||||
class _BMSkipTable;
|
||||
|
||||
// General case for BM data searching; use a map
|
||||
template <class _Key,
|
||||
class _Value,
|
||||
class _Hash,
|
||||
class _BinaryPredicate>
|
||||
template <class _Key, class _Value, class _Hash, class _BinaryPredicate>
|
||||
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
|
||||
private:
|
||||
using value_type = _Value;
|
||||
using key_type = _Key;
|
||||
using key_type = _Key;
|
||||
|
||||
const value_type __default_value_;
|
||||
unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
explicit _BMSkipTable(size_t __sz, value_type __default_value, _Hash __hash, _BinaryPredicate __pred)
|
||||
: __default_value_(__default_value),
|
||||
__table_(__sz, __hash, __pred) {}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit _BMSkipTable(
|
||||
size_t __sz, value_type __default_value, _Hash __hash, _BinaryPredicate __pred)
|
||||
: __default_value_(__default_value), __table_(__sz, __hash, __pred) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void insert(const key_type& __key, value_type __val) {
|
||||
__table_[__key] = __val;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI void insert(const key_type& __key, value_type __val) { __table_[__key] = __val; }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI value_type operator[](const key_type& __key) const {
|
||||
auto __it = __table_.find(__key);
|
||||
|
@ -66,14 +60,11 @@ public:
|
|||
};
|
||||
|
||||
// Special case small numeric values; use an array
|
||||
template <class _Key,
|
||||
class _Value,
|
||||
class _Hash,
|
||||
class _BinaryPredicate>
|
||||
template <class _Key, class _Value, class _Hash, class _BinaryPredicate>
|
||||
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
|
||||
private:
|
||||
using value_type = _Value;
|
||||
using key_type = _Key;
|
||||
using key_type = _Key;
|
||||
|
||||
using unsigned_key_type = make_unsigned_t<key_type>;
|
||||
std::array<value_type, 256> __table_;
|
||||
|
@ -94,34 +85,33 @@ public:
|
|||
};
|
||||
|
||||
template <class _RandomAccessIterator1,
|
||||
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
|
||||
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
|
||||
class _BinaryPredicate = equal_to<>>
|
||||
class _LIBCPP_TEMPLATE_VIS boyer_moore_searcher {
|
||||
private:
|
||||
using difference_type = typename std::iterator_traits<_RandomAccessIterator1>::difference_type;
|
||||
using value_type = typename std::iterator_traits<_RandomAccessIterator1>::value_type;
|
||||
using __skip_table_type = _BMSkipTable<value_type,
|
||||
difference_type,
|
||||
_Hash,
|
||||
_BinaryPredicate,
|
||||
is_integral_v<value_type>
|
||||
&& sizeof(value_type) == 1
|
||||
&& is_same_v<_Hash, hash<value_type>>
|
||||
&& is_same_v<_BinaryPredicate, equal_to<>>>;
|
||||
using value_type = typename std::iterator_traits<_RandomAccessIterator1>::value_type;
|
||||
using __skip_table_type =
|
||||
_BMSkipTable<value_type,
|
||||
difference_type,
|
||||
_Hash,
|
||||
_BinaryPredicate,
|
||||
is_integral_v<value_type> && sizeof(value_type) == 1 && is_same_v<_Hash, hash<value_type>> &&
|
||||
is_same_v<_BinaryPredicate, equal_to<>>>;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
boyer_moore_searcher(_RandomAccessIterator1 __first,
|
||||
_RandomAccessIterator1 __last,
|
||||
_Hash __hash = _Hash(),
|
||||
_BinaryPredicate __pred = _BinaryPredicate())
|
||||
: __first_(__first),
|
||||
__last_(__last),
|
||||
__pred_(__pred),
|
||||
__pattern_length_(__last - __first),
|
||||
__skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, -1, __hash, __pred_)),
|
||||
__suffix_(std::__allocate_shared_unbounded_array<difference_type[]>(
|
||||
allocator<difference_type>(), __pattern_length_ + 1)) {
|
||||
_LIBCPP_HIDE_FROM_ABI boyer_moore_searcher(
|
||||
_RandomAccessIterator1 __first,
|
||||
_RandomAccessIterator1 __last,
|
||||
_Hash __hash = _Hash(),
|
||||
_BinaryPredicate __pred = _BinaryPredicate())
|
||||
: __first_(__first),
|
||||
__last_(__last),
|
||||
__pred_(__pred),
|
||||
__pattern_length_(__last - __first),
|
||||
__skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, -1, __hash, __pred_)),
|
||||
__suffix_(std::__allocate_shared_unbounded_array<difference_type[]>(
|
||||
allocator<difference_type>(), __pattern_length_ + 1)) {
|
||||
difference_type __i = 0;
|
||||
while (__first != __last) {
|
||||
__skip_table_->insert(*__first, __i);
|
||||
|
@ -158,8 +148,8 @@ private:
|
|||
template <class _RandomAccessIterator2>
|
||||
_LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
|
||||
__search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
|
||||
_RandomAccessIterator2 __current = __f;
|
||||
const _RandomAccessIterator2 __last = __l - __pattern_length_;
|
||||
_RandomAccessIterator2 __current = __f;
|
||||
const _RandomAccessIterator2 __last = __l - __pattern_length_;
|
||||
const __skip_table_type& __skip_table = *__skip_table_;
|
||||
|
||||
while (__current <= __last) {
|
||||
|
@ -186,7 +176,7 @@ private:
|
|||
const size_t __count = __last - __first;
|
||||
|
||||
__prefix[0] = 0;
|
||||
size_t __k = 0;
|
||||
size_t __k = 0;
|
||||
|
||||
for (size_t __i = 1; __i != __count; ++__i) {
|
||||
while (__k > 0 && !__pred(__first[__k], __first[__i]))
|
||||
|
@ -215,7 +205,7 @@ private:
|
|||
__compute_bm_prefix(_ReverseIter(__last), _ReverseIter(__first), __pred, __scratch);
|
||||
|
||||
for (size_t __i = 0; __i != __count; ++__i) {
|
||||
const size_t __j = __count - __scratch[__i];
|
||||
const size_t __j = __count - __scratch[__i];
|
||||
const difference_type __k = __i - __scratch[__i] + 1;
|
||||
|
||||
if (__suffix_[__j] > __k)
|
||||
|
@ -226,31 +216,31 @@ private:
|
|||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(boyer_moore_searcher);
|
||||
|
||||
template <class _RandomAccessIterator1,
|
||||
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
|
||||
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
|
||||
class _BinaryPredicate = equal_to<>>
|
||||
class _LIBCPP_TEMPLATE_VIS boyer_moore_horspool_searcher {
|
||||
private:
|
||||
using difference_type = typename iterator_traits<_RandomAccessIterator1>::difference_type;
|
||||
using value_type = typename iterator_traits<_RandomAccessIterator1>::value_type;
|
||||
using __skip_table_type = _BMSkipTable<value_type,
|
||||
difference_type,
|
||||
_Hash,
|
||||
_BinaryPredicate,
|
||||
is_integral_v<value_type>
|
||||
&& sizeof(value_type) == 1
|
||||
&& is_same_v<_Hash, hash<value_type>>
|
||||
&& is_same_v<_BinaryPredicate, equal_to<>>>;
|
||||
using value_type = typename iterator_traits<_RandomAccessIterator1>::value_type;
|
||||
using __skip_table_type =
|
||||
_BMSkipTable<value_type,
|
||||
difference_type,
|
||||
_Hash,
|
||||
_BinaryPredicate,
|
||||
is_integral_v<value_type> && sizeof(value_type) == 1 && is_same_v<_Hash, hash<value_type>> &&
|
||||
is_same_v<_BinaryPredicate, equal_to<>>>;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
boyer_moore_horspool_searcher(_RandomAccessIterator1 __first,
|
||||
_RandomAccessIterator1 __last,
|
||||
_Hash __hash = _Hash(),
|
||||
_BinaryPredicate __pred = _BinaryPredicate())
|
||||
: __first_(__first),
|
||||
__last_(__last),
|
||||
__pred_(__pred),
|
||||
__pattern_length_(__last - __first),
|
||||
__skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, __pattern_length_, __hash, __pred_)) {
|
||||
_LIBCPP_HIDE_FROM_ABI boyer_moore_horspool_searcher(
|
||||
_RandomAccessIterator1 __first,
|
||||
_RandomAccessIterator1 __last,
|
||||
_Hash __hash = _Hash(),
|
||||
_BinaryPredicate __pred = _BinaryPredicate())
|
||||
: __first_(__first),
|
||||
__last_(__last),
|
||||
__pred_(__pred),
|
||||
__pattern_length_(__last - __first),
|
||||
__skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, __pattern_length_, __hash, __pred_)) {
|
||||
if (__first == __last)
|
||||
return;
|
||||
--__last;
|
||||
|
@ -289,8 +279,8 @@ private:
|
|||
template <class _RandomAccessIterator2>
|
||||
_LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
|
||||
__search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
|
||||
_RandomAccessIterator2 __current = __f;
|
||||
const _RandomAccessIterator2 __last = __l - __pattern_length_;
|
||||
_RandomAccessIterator2 __current = __f;
|
||||
const _RandomAccessIterator2 __last = __l - __pattern_length_;
|
||||
const __skip_table_type& __skip_table = *__skip_table_;
|
||||
|
||||
while (__current <= __last) {
|
||||
|
|
25
third_party/libcxx/__functional/compose.h
vendored
25
third_party/libcxx/__functional/compose.h
vendored
|
@ -25,25 +25,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER >= 20
|
||||
|
||||
struct __compose_op {
|
||||
template<class _Fn1, class _Fn2, class ..._Args>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const
|
||||
noexcept(noexcept(_VSTD::invoke(_VSTD::forward<_Fn1>(__f1), _VSTD::invoke(_VSTD::forward<_Fn2>(__f2), _VSTD::forward<_Args>(__args)...))))
|
||||
-> decltype( _VSTD::invoke(_VSTD::forward<_Fn1>(__f1), _VSTD::invoke(_VSTD::forward<_Fn2>(__f2), _VSTD::forward<_Args>(__args)...)))
|
||||
{ return _VSTD::invoke(_VSTD::forward<_Fn1>(__f1), _VSTD::invoke(_VSTD::forward<_Fn2>(__f2), _VSTD::forward<_Args>(__args)...)); }
|
||||
template <class _Fn1, class _Fn2, class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const noexcept(noexcept(
|
||||
std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))))
|
||||
-> decltype(std::invoke(std::forward<_Fn1>(__f1),
|
||||
std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))) {
|
||||
return std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Fn1, class _Fn2>
|
||||
struct __compose_t : __perfect_forward<__compose_op, _Fn1, _Fn2> {
|
||||
using __perfect_forward<__compose_op, _Fn1, _Fn2>::__perfect_forward;
|
||||
using __perfect_forward<__compose_op, _Fn1, _Fn2>::__perfect_forward;
|
||||
};
|
||||
|
||||
template <class _Fn1, class _Fn2>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2)
|
||||
noexcept(noexcept(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(_VSTD::forward<_Fn1>(__f1), _VSTD::forward<_Fn2>(__f2))))
|
||||
-> decltype( __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(_VSTD::forward<_Fn1>(__f1), _VSTD::forward<_Fn2>(__f2)))
|
||||
{ return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(_VSTD::forward<_Fn1>(__f1), _VSTD::forward<_Fn2>(__f2)); }
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2) noexcept(
|
||||
noexcept(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))))
|
||||
-> decltype(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))) {
|
||||
return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 20
|
||||
|
||||
|
|
|
@ -26,27 +26,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
// default searcher
|
||||
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
|
||||
template <class _ForwardIterator, class _BinaryPredicate = equal_to<>>
|
||||
class _LIBCPP_TEMPLATE_VIS default_searcher {
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
default_searcher(_ForwardIterator __f, _ForwardIterator __l,
|
||||
_BinaryPredicate __p = _BinaryPredicate())
|
||||
: __first_(__f), __last_(__l), __pred_(__p) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
default_searcher(_ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate())
|
||||
: __first_(__f), __last_(__l), __pred_(__p) {}
|
||||
|
||||
template <typename _ForwardIterator2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
pair<_ForwardIterator2, _ForwardIterator2>
|
||||
operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
|
||||
{
|
||||
auto __proj = __identity();
|
||||
return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
|
||||
}
|
||||
template <typename _ForwardIterator2>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator2, _ForwardIterator2>
|
||||
operator()(_ForwardIterator2 __f, _ForwardIterator2 __l) const {
|
||||
auto __proj = __identity();
|
||||
return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
|
||||
}
|
||||
|
||||
private:
|
||||
_ForwardIterator __first_;
|
||||
_ForwardIterator __last_;
|
||||
_BinaryPredicate __pred_;
|
||||
_ForwardIterator __first_;
|
||||
_ForwardIterator __last_;
|
||||
_BinaryPredicate __pred_;
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher);
|
||||
|
||||
|
|
1640
third_party/libcxx/__functional/function.h
vendored
1640
third_party/libcxx/__functional/function.h
vendored
File diff suppressed because it is too large
Load diff
695
third_party/libcxx/__functional/hash.h
vendored
695
third_party/libcxx/__functional/hash.h
vendored
|
@ -10,23 +10,18 @@
|
|||
#define _LIBCPP___FUNCTIONAL_HASH_H
|
||||
|
||||
#include <__config>
|
||||
#include <__functional/invoke.h>
|
||||
#include <__functional/unary_function.h>
|
||||
#include <__fwd/hash.h>
|
||||
#include <__tuple/sfinae_helpers.h>
|
||||
#include <__type_traits/is_copy_constructible.h>
|
||||
#include <__type_traits/is_default_constructible.h>
|
||||
#include <__fwd/functional.h>
|
||||
#include <__type_traits/conjunction.h>
|
||||
#include <__type_traits/invoke.h>
|
||||
#include <__type_traits/is_constructible.h>
|
||||
#include <__type_traits/is_enum.h>
|
||||
#include <__type_traits/is_move_constructible.h>
|
||||
#include <__type_traits/underlying_type.h>
|
||||
#include <__utility/forward.h>
|
||||
#include <__utility/move.h>
|
||||
#include <__utility/pair.h>
|
||||
#include <__utility/swap.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
|
@ -35,133 +30,117 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Size>
|
||||
inline _LIBCPP_HIDE_FROM_ABI
|
||||
_Size
|
||||
__loadword(const void* __p)
|
||||
{
|
||||
_Size __r;
|
||||
_VSTD::memcpy(&__r, __p, sizeof(__r));
|
||||
return __r;
|
||||
inline _LIBCPP_HIDE_FROM_ABI _Size __loadword(const void* __p) {
|
||||
_Size __r;
|
||||
std::memcpy(&__r, __p, sizeof(__r));
|
||||
return __r;
|
||||
}
|
||||
|
||||
// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
|
||||
// is 64 bits. This is because cityhash64 uses 64bit x 64bit
|
||||
// multiplication, which can be very slow on 32-bit systems.
|
||||
template <class _Size, size_t = sizeof(_Size)*__CHAR_BIT__>
|
||||
template <class _Size, size_t = sizeof(_Size) * __CHAR_BIT__>
|
||||
struct __murmur2_or_cityhash;
|
||||
|
||||
template <class _Size>
|
||||
struct __murmur2_or_cityhash<_Size, 32>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
_Size operator()(const void* __key, _Size __len) const {
|
||||
// murmur2
|
||||
const _Size __m = 0x5bd1e995;
|
||||
const _Size __r = 24;
|
||||
_Size __h = __len;
|
||||
const unsigned char* __data = static_cast<const unsigned char*>(__key);
|
||||
for (; __len >= 4; __data += 4, __len -= 4)
|
||||
{
|
||||
_Size __k = std::__loadword<_Size>(__data);
|
||||
__k *= __m;
|
||||
__k ^= __k >> __r;
|
||||
__k *= __m;
|
||||
__h *= __m;
|
||||
__h ^= __k;
|
||||
}
|
||||
switch (__len)
|
||||
{
|
||||
case 3:
|
||||
__h ^= static_cast<_Size>(__data[2] << 16);
|
||||
_LIBCPP_FALLTHROUGH();
|
||||
case 2:
|
||||
__h ^= static_cast<_Size>(__data[1] << 8);
|
||||
_LIBCPP_FALLTHROUGH();
|
||||
case 1:
|
||||
__h ^= __data[0];
|
||||
__h *= __m;
|
||||
}
|
||||
__h ^= __h >> 13;
|
||||
struct __murmur2_or_cityhash<_Size, 32> {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK _Size
|
||||
operator()(const void* __key, _Size __len) const {
|
||||
// murmur2
|
||||
const _Size __m = 0x5bd1e995;
|
||||
const _Size __r = 24;
|
||||
_Size __h = __len;
|
||||
const unsigned char* __data = static_cast<const unsigned char*>(__key);
|
||||
for (; __len >= 4; __data += 4, __len -= 4) {
|
||||
_Size __k = std::__loadword<_Size>(__data);
|
||||
__k *= __m;
|
||||
__k ^= __k >> __r;
|
||||
__k *= __m;
|
||||
__h *= __m;
|
||||
__h ^= __h >> 15;
|
||||
return __h;
|
||||
__h ^= __k;
|
||||
}
|
||||
switch (__len) {
|
||||
case 3:
|
||||
__h ^= static_cast<_Size>(__data[2] << 16);
|
||||
_LIBCPP_FALLTHROUGH();
|
||||
case 2:
|
||||
__h ^= static_cast<_Size>(__data[1] << 8);
|
||||
_LIBCPP_FALLTHROUGH();
|
||||
case 1:
|
||||
__h ^= __data[0];
|
||||
__h *= __m;
|
||||
}
|
||||
__h ^= __h >> 13;
|
||||
__h *= __m;
|
||||
__h ^= __h >> 15;
|
||||
return __h;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Size>
|
||||
struct __murmur2_or_cityhash<_Size, 64>
|
||||
{
|
||||
struct __murmur2_or_cityhash<_Size, 64> {
|
||||
// cityhash64
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
_Size operator()(const void* __key, _Size __len) const {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK _Size
|
||||
operator()(const void* __key, _Size __len) const {
|
||||
const char* __s = static_cast<const char*>(__key);
|
||||
if (__len <= 32) {
|
||||
if (__len <= 16) {
|
||||
if (__len <= 16) {
|
||||
return __hash_len_0_to_16(__s, __len);
|
||||
} else {
|
||||
} else {
|
||||
return __hash_len_17_to_32(__s, __len);
|
||||
}
|
||||
}
|
||||
} else if (__len <= 64) {
|
||||
return __hash_len_33_to_64(__s, __len);
|
||||
return __hash_len_33_to_64(__s, __len);
|
||||
}
|
||||
|
||||
// For strings over 64 bytes we hash the end first, and then as we
|
||||
// loop we keep 56 bytes of state: v, w, x, y, and z.
|
||||
_Size __x = std::__loadword<_Size>(__s + __len - 40);
|
||||
_Size __y = std::__loadword<_Size>(__s + __len - 16) +
|
||||
std::__loadword<_Size>(__s + __len - 56);
|
||||
_Size __z = __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len,
|
||||
std::__loadword<_Size>(__s + __len - 24));
|
||||
_Size __y = std::__loadword<_Size>(__s + __len - 16) + std::__loadword<_Size>(__s + __len - 56);
|
||||
_Size __z =
|
||||
__hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, std::__loadword<_Size>(__s + __len - 24));
|
||||
pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
|
||||
pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
|
||||
__x = __x * __k1 + std::__loadword<_Size>(__s);
|
||||
__x = __x * __k1 + std::__loadword<_Size>(__s);
|
||||
|
||||
// Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
|
||||
__len = (__len - 1) & ~static_cast<_Size>(63);
|
||||
do {
|
||||
__x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1;
|
||||
__y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1;
|
||||
__x ^= __w.second;
|
||||
__y += __v.first + std::__loadword<_Size>(__s + 40);
|
||||
__z = __rotate(__z + __w.first, 33) * __k1;
|
||||
__v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
|
||||
__w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
|
||||
__y + std::__loadword<_Size>(__s + 16));
|
||||
_VSTD::swap(__z, __x);
|
||||
__s += 64;
|
||||
__len -= 64;
|
||||
__x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1;
|
||||
__y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1;
|
||||
__x ^= __w.second;
|
||||
__y += __v.first + std::__loadword<_Size>(__s + 40);
|
||||
__z = __rotate(__z + __w.first, 33) * __k1;
|
||||
__v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
|
||||
__w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, __y + std::__loadword<_Size>(__s + 16));
|
||||
std::swap(__z, __x);
|
||||
__s += 64;
|
||||
__len -= 64;
|
||||
} while (__len != 0);
|
||||
return __hash_len_16(
|
||||
__hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
|
||||
__hash_len_16(__v.second, __w.second) + __x);
|
||||
return __hash_len_16(__hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
|
||||
__hash_len_16(__v.second, __w.second) + __x);
|
||||
}
|
||||
|
||||
private:
|
||||
// Some primes between 2^63 and 2^64.
|
||||
static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
|
||||
static const _Size __k1 = 0xb492b66fbe98f273ULL;
|
||||
static const _Size __k2 = 0x9ae16a3b2f90404fULL;
|
||||
static const _Size __k3 = 0xc949d7c7509e6557ULL;
|
||||
private:
|
||||
// Some primes between 2^63 and 2^64.
|
||||
static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
|
||||
static const _Size __k1 = 0xb492b66fbe98f273ULL;
|
||||
static const _Size __k2 = 0x9ae16a3b2f90404fULL;
|
||||
static const _Size __k3 = 0xc949d7c7509e6557ULL;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
static _Size __rotate(_Size __val, int __shift) {
|
||||
_LIBCPP_HIDE_FROM_ABI static _Size __rotate(_Size __val, int __shift) {
|
||||
return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift)));
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
|
||||
_LIBCPP_HIDE_FROM_ABI static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
|
||||
return (__val >> __shift) | (__val << (64 - __shift));
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
static _Size __shift_mix(_Size __val) {
|
||||
return __val ^ (__val >> 47);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI static _Size __shift_mix(_Size __val) { return __val ^ (__val >> 47); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
static _Size __hash_len_16(_Size __u, _Size __v) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size __hash_len_16(_Size __u, _Size __v) {
|
||||
const _Size __mul = 0x9ddfea08eb382d69ULL;
|
||||
_Size __a = (__u ^ __v) * __mul;
|
||||
_Size __a = (__u ^ __v) * __mul;
|
||||
__a ^= (__a >> 47);
|
||||
_Size __b = (__v ^ __a) * __mul;
|
||||
__b ^= (__b >> 47);
|
||||
|
@ -169,8 +148,8 @@ struct __murmur2_or_cityhash<_Size, 64>
|
|||
return __b;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
static _Size __hash_len_0_to_16(const char* __s, _Size __len) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
|
||||
__hash_len_0_to_16(const char* __s, _Size __len) {
|
||||
if (__len > 8) {
|
||||
const _Size __a = std::__loadword<_Size>(__s);
|
||||
const _Size __b = std::__loadword<_Size>(__s + __len - 8);
|
||||
|
@ -189,32 +168,29 @@ struct __murmur2_or_cityhash<_Size, 64>
|
|||
const unsigned char __a = static_cast<unsigned char>(__s[0]);
|
||||
const unsigned char __b = static_cast<unsigned char>(__s[__len >> 1]);
|
||||
const unsigned char __c = static_cast<unsigned char>(__s[__len - 1]);
|
||||
const uint32_t __y = static_cast<uint32_t>(__a) +
|
||||
(static_cast<uint32_t>(__b) << 8);
|
||||
const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
|
||||
const uint32_t __y = static_cast<uint32_t>(__a) + (static_cast<uint32_t>(__b) << 8);
|
||||
const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
|
||||
return __shift_mix(__y * __k2 ^ __z * __k3) * __k2;
|
||||
}
|
||||
return __k2;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
static _Size __hash_len_17_to_32(const char *__s, _Size __len) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
|
||||
__hash_len_17_to_32(const char* __s, _Size __len) {
|
||||
const _Size __a = std::__loadword<_Size>(__s) * __k1;
|
||||
const _Size __b = std::__loadword<_Size>(__s + 8);
|
||||
const _Size __c = std::__loadword<_Size>(__s + __len - 8) * __k2;
|
||||
const _Size __d = std::__loadword<_Size>(__s + __len - 16) * __k0;
|
||||
return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
|
||||
__a + __rotate(__b ^ __k3, 20) - __c + __len);
|
||||
return __hash_len_16(
|
||||
__rotate(__a - __b, 43) + __rotate(__c, 30) + __d, __a + __rotate(__b ^ __k3, 20) - __c + __len);
|
||||
}
|
||||
|
||||
// Return a 16-byte hash for 48 bytes. Quick and dirty.
|
||||
// Callers do best to use "random-looking" values for a and b.
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
|
||||
_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b)
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
|
||||
__weak_hash_len_32_with_seeds(_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) {
|
||||
__a += __w;
|
||||
__b = __rotate(__b + __a + __z, 21);
|
||||
__b = __rotate(__b + __a + __z, 21);
|
||||
const _Size __c = __a;
|
||||
__a += __x;
|
||||
__a += __y;
|
||||
|
@ -223,24 +199,22 @@ struct __murmur2_or_cityhash<_Size, 64>
|
|||
}
|
||||
|
||||
// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
|
||||
const char* __s, _Size __a, _Size __b)
|
||||
{
|
||||
return __weak_hash_len_32_with_seeds(std::__loadword<_Size>(__s),
|
||||
std::__loadword<_Size>(__s + 8),
|
||||
std::__loadword<_Size>(__s + 16),
|
||||
std::__loadword<_Size>(__s + 24),
|
||||
__a,
|
||||
__b);
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
|
||||
__weak_hash_len_32_with_seeds(const char* __s, _Size __a, _Size __b) {
|
||||
return __weak_hash_len_32_with_seeds(
|
||||
std::__loadword<_Size>(__s),
|
||||
std::__loadword<_Size>(__s + 8),
|
||||
std::__loadword<_Size>(__s + 16),
|
||||
std::__loadword<_Size>(__s + 24),
|
||||
__a,
|
||||
__b);
|
||||
}
|
||||
|
||||
// Return an 8-byte hash for 33 to 64 bytes.
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
static _Size __hash_len_33_to_64(const char *__s, size_t __len) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
|
||||
__hash_len_33_to_64(const char* __s, size_t __len) {
|
||||
_Size __z = std::__loadword<_Size>(__s + 24);
|
||||
_Size __a = std::__loadword<_Size>(__s) +
|
||||
(__len + std::__loadword<_Size>(__s + __len - 16)) * __k0;
|
||||
_Size __a = std::__loadword<_Size>(__s) + (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0;
|
||||
_Size __b = __rotate(__a + __z, 52);
|
||||
_Size __c = __rotate(__a, 37);
|
||||
__a += std::__loadword<_Size>(__s + 8);
|
||||
|
@ -248,7 +222,7 @@ struct __murmur2_or_cityhash<_Size, 64>
|
|||
__a += std::__loadword<_Size>(__s + 16);
|
||||
_Size __vf = __a + __z;
|
||||
_Size __vs = __b + __rotate(__a, 31) + __c;
|
||||
__a = std::__loadword<_Size>(__s + 16) + std::__loadword<_Size>(__s + __len - 32);
|
||||
__a = std::__loadword<_Size>(__s + 16) + std::__loadword<_Size>(__s + __len - 32);
|
||||
__z += std::__loadword<_Size>(__s + __len - 8);
|
||||
__b = __rotate(__a + __z, 52);
|
||||
__c = __rotate(__a, 37);
|
||||
|
@ -257,7 +231,7 @@ struct __murmur2_or_cityhash<_Size, 64>
|
|||
__a += std::__loadword<_Size>(__s + __len - 16);
|
||||
_Size __wf = __a + __z;
|
||||
_Size __ws = __b + __rotate(__a, 31) + __c;
|
||||
_Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
|
||||
_Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
|
||||
return __shift_mix(__r * __k0 + __vs) * __k2;
|
||||
}
|
||||
};
|
||||
|
@ -266,104 +240,76 @@ template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
|
|||
struct __scalar_hash;
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 0>
|
||||
: public __unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
size_t __a;
|
||||
} __u;
|
||||
__u.__a = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__a;
|
||||
}
|
||||
struct __scalar_hash<_Tp, 0> : public __unary_function<_Tp, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
|
||||
union {
|
||||
_Tp __t;
|
||||
size_t __a;
|
||||
} __u;
|
||||
__u.__a = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__a;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 1>
|
||||
: public __unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
size_t __a;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __u.__a;
|
||||
}
|
||||
struct __scalar_hash<_Tp, 1> : public __unary_function<_Tp, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
|
||||
union {
|
||||
_Tp __t;
|
||||
size_t __a;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __u.__a;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 2>
|
||||
: public __unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
struct __scalar_hash<_Tp, 2> : public __unary_function<_Tp, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
|
||||
union {
|
||||
_Tp __t;
|
||||
struct {
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 3>
|
||||
: public __unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
struct __scalar_hash<_Tp, 3> : public __unary_function<_Tp, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
|
||||
union {
|
||||
_Tp __t;
|
||||
struct {
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 4>
|
||||
: public __unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
size_t __d;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
struct __scalar_hash<_Tp, 4> : public __unary_function<_Tp, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
|
||||
union {
|
||||
_Tp __t;
|
||||
struct {
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
size_t __d;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
};
|
||||
|
||||
struct _PairT {
|
||||
|
@ -371,314 +317,223 @@ struct _PairT {
|
|||
size_t second;
|
||||
};
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
|
||||
typedef __scalar_hash<_PairT> _HashT;
|
||||
const _PairT __p = {__lhs, __rhs};
|
||||
return _HashT()(__p);
|
||||
_LIBCPP_HIDE_FROM_ABI inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
|
||||
typedef __scalar_hash<_PairT> _HashT;
|
||||
const _PairT __p = {__lhs, __rhs};
|
||||
return _HashT()(__p);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<_Tp*>
|
||||
: public __unary_function<_Tp*, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(_Tp* __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp* __t;
|
||||
size_t __a;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<_Tp*> : public __unary_function<_Tp*, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp* __v) const _NOEXCEPT {
|
||||
union {
|
||||
_Tp* __t;
|
||||
size_t __a;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<bool>
|
||||
: public __unary_function<bool, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<bool> : public __unary_function<bool, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(bool __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char>
|
||||
: public __unary_function<char, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char> : public __unary_function<char, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<signed char>
|
||||
: public __unary_function<signed char, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public __unary_function<signed char, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(signed char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
|
||||
: public __unary_function<unsigned char, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public __unary_function<unsigned char, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char8_t>
|
||||
: public __unary_function<char8_t, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char8_t> : public __unary_function<char8_t, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(char8_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
#endif // !_LIBCPP_HAS_NO_CHAR8_T
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
|
||||
: public __unary_function<char16_t, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char16_t> : public __unary_function<char16_t, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(char16_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
|
||||
: public __unary_function<char32_t, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char32_t> : public __unary_function<char32_t, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(char32_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
|
||||
: public __unary_function<wchar_t, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<wchar_t> : public __unary_function<wchar_t, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(wchar_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<short>
|
||||
: public __unary_function<short, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<short> : public __unary_function<short, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(short __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
|
||||
: public __unary_function<unsigned short, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public __unary_function<unsigned short, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned short __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<int>
|
||||
: public __unary_function<int, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<int> : public __unary_function<int, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(int __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
|
||||
: public __unary_function<unsigned int, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public __unary_function<unsigned int, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned int __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long>
|
||||
: public __unary_function<long, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long> : public __unary_function<long, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(long __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
|
||||
: public __unary_function<unsigned long, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public __unary_function<unsigned long, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned long __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long long>
|
||||
: public __scalar_hash<long long>
|
||||
{
|
||||
};
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long long> : public __scalar_hash<long long> {};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long>
|
||||
: public __scalar_hash<unsigned long long>
|
||||
{
|
||||
};
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long> : public __scalar_hash<unsigned long long> {};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_INT128
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__int128_t>
|
||||
: public __scalar_hash<__int128_t>
|
||||
{
|
||||
};
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__int128_t> : public __scalar_hash<__int128_t> {};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t>
|
||||
: public __scalar_hash<__uint128_t>
|
||||
{
|
||||
};
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t> : public __scalar_hash<__uint128_t> {};
|
||||
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<float>
|
||||
: public __scalar_hash<float>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(float __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0.0f)
|
||||
return 0;
|
||||
return __scalar_hash<float>::operator()(__v);
|
||||
}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<float> : public __scalar_hash<float> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(float __v) const _NOEXCEPT {
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0.0f)
|
||||
return 0;
|
||||
return __scalar_hash<float>::operator()(__v);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<double>
|
||||
: public __scalar_hash<double>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(double __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0.0)
|
||||
return 0;
|
||||
return __scalar_hash<double>::operator()(__v);
|
||||
}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<double> : public __scalar_hash<double> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(double __v) const _NOEXCEPT {
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0.0)
|
||||
return 0;
|
||||
return __scalar_hash<double>::operator()(__v);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long double>
|
||||
: public __scalar_hash<long double>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(long double __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0.0L)
|
||||
return 0;
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long double> : public __scalar_hash<long double> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(long double __v) const _NOEXCEPT {
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0.0L)
|
||||
return 0;
|
||||
#if defined(__i386__) || (defined(__x86_64__) && defined(__ILP32__))
|
||||
// Zero out padding bits
|
||||
union
|
||||
{
|
||||
long double __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
size_t __d;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__s.__c = 0;
|
||||
__u.__s.__d = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
|
||||
// Zero out padding bits
|
||||
union {
|
||||
long double __t;
|
||||
struct {
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
size_t __d;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__s.__c = 0;
|
||||
__u.__s.__d = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
|
||||
#elif defined(__x86_64__)
|
||||
// Zero out padding bits
|
||||
union
|
||||
{
|
||||
long double __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b;
|
||||
// Zero out padding bits
|
||||
union {
|
||||
long double __t;
|
||||
struct {
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b;
|
||||
#else
|
||||
return __scalar_hash<long double>::operator()(__v);
|
||||
return __scalar_hash<long double>::operator()(__v);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp, bool = is_enum<_Tp>::value>
|
||||
struct _LIBCPP_TEMPLATE_VIS __enum_hash
|
||||
: public __unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
typedef typename underlying_type<_Tp>::type type;
|
||||
return hash<type>()(static_cast<type>(__v));
|
||||
}
|
||||
struct _LIBCPP_TEMPLATE_VIS __enum_hash : public __unary_function<_Tp, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
|
||||
typedef typename underlying_type<_Tp>::type type;
|
||||
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;
|
||||
__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>
|
||||
{
|
||||
};
|
||||
struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp> {};
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
|
||||
: public __unary_function<nullptr_t, size_t>
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
size_t operator()(nullptr_t) const _NOEXCEPT {
|
||||
return 662607004ull;
|
||||
}
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t> : public __unary_function<nullptr_t, size_t> {
|
||||
_LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; }
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class _Hash>
|
||||
using __check_hash_requirements _LIBCPP_NODEBUG = integral_constant<bool,
|
||||
is_copy_constructible<_Hash>::value &&
|
||||
is_move_constructible<_Hash>::value &&
|
||||
__invokable_r<size_t, _Hash, _Key const&>::value
|
||||
>;
|
||||
using __check_hash_requirements _LIBCPP_NODEBUG =
|
||||
integral_constant<bool,
|
||||
is_copy_constructible<_Hash>::value && is_move_constructible<_Hash>::value &&
|
||||
__invokable_r<size_t, _Hash, _Key const&>::value >;
|
||||
|
||||
template <class _Key, class _Hash = hash<_Key> >
|
||||
using __has_enabled_hash _LIBCPP_NODEBUG = integral_constant<bool,
|
||||
__check_hash_requirements<_Key, _Hash>::value &&
|
||||
is_default_constructible<_Hash>::value
|
||||
>;
|
||||
using __has_enabled_hash _LIBCPP_NODEBUG =
|
||||
integral_constant<bool, __check_hash_requirements<_Key, _Hash>::value && is_default_constructible<_Hash>::value >;
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
# if _LIBCPP_STD_VER >= 17
|
||||
template <class _Type, class>
|
||||
using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type;
|
||||
|
||||
template <class _Type, class ..._Keys>
|
||||
using __enable_hash_helper _LIBCPP_NODEBUG = __enable_hash_helper_imp<_Type,
|
||||
typename enable_if<__all<__has_enabled_hash<_Keys>::value...>::value>::type
|
||||
>;
|
||||
#else
|
||||
template <class _Type, class ...>
|
||||
template <class _Type, class... _Keys>
|
||||
using __enable_hash_helper _LIBCPP_NODEBUG =
|
||||
__enable_hash_helper_imp<_Type, __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value> >;
|
||||
# else
|
||||
template <class _Type, class...>
|
||||
using __enable_hash_helper _LIBCPP_NODEBUG = _Type;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
|
|
20
third_party/libcxx/__functional/identity.h
vendored
20
third_party/libcxx/__functional/identity.h
vendored
|
@ -11,6 +11,7 @@
|
|||
#define _LIBCPP___FUNCTIONAL_IDENTITY_H
|
||||
|
||||
#include <__config>
|
||||
#include <__fwd/functional.h>
|
||||
#include <__type_traits/integral_constant.h>
|
||||
#include <__utility/forward.h>
|
||||
|
||||
|
@ -34,21 +35,28 @@ struct __identity {
|
|||
|
||||
template <>
|
||||
struct __is_identity<__identity> : true_type {};
|
||||
template <>
|
||||
struct __is_identity<reference_wrapper<__identity> > : true_type {};
|
||||
template <>
|
||||
struct __is_identity<reference_wrapper<const __identity> > : true_type {};
|
||||
|
||||
#if _LIBCPP_STD_VER >= 20
|
||||
|
||||
struct identity {
|
||||
template<class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept
|
||||
{
|
||||
return _VSTD::forward<_Tp>(__t);
|
||||
}
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept {
|
||||
return std::forward<_Tp>(__t);
|
||||
}
|
||||
|
||||
using is_transparent = void;
|
||||
using is_transparent = void;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct __is_identity<identity> : true_type {};
|
||||
template <>
|
||||
struct __is_identity<reference_wrapper<identity> > : true_type {};
|
||||
template <>
|
||||
struct __is_identity<reference_wrapper<const identity> > : true_type {};
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 20
|
||||
|
||||
|
|
30
third_party/libcxx/__functional/invoke.h
vendored
30
third_party/libcxx/__functional/invoke.h
vendored
|
@ -22,12 +22,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
template <class _Fn, class ..._Args>
|
||||
template <class _Fn, class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...>
|
||||
invoke(_Fn&& __f, _Args&&... __args)
|
||||
noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
|
||||
{
|
||||
return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
|
||||
invoke(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_v<_Fn, _Args...>) {
|
||||
return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
@ -37,17 +35,17 @@ template <class _Result, class _Fn, class... _Args>
|
|||
requires is_invocable_r_v<_Result, _Fn, _Args...>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr _Result
|
||||
invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result, _Fn, _Args...>) {
|
||||
if constexpr (is_void_v<_Result>) {
|
||||
static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...));
|
||||
} else {
|
||||
// TODO: Use reference_converts_from_temporary_v once implemented
|
||||
// using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>;
|
||||
// static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>,
|
||||
static_assert(true,
|
||||
"Returning from invoke_r would bind a temporary object to the reference return type, "
|
||||
"which would result in a dangling reference.");
|
||||
return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
|
||||
}
|
||||
if constexpr (is_void_v<_Result>) {
|
||||
static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...));
|
||||
} else {
|
||||
// TODO: Use reference_converts_from_temporary_v once implemented
|
||||
// using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>;
|
||||
// static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>,
|
||||
static_assert(true,
|
||||
"Returning from invoke_r would bind a temporary object to the reference return type, "
|
||||
"which would result in a dangling reference.");
|
||||
return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#define _LIBCPP___FUNCTIONAL_IS_TRANSPARENT
|
||||
|
||||
#include <__config>
|
||||
#include <__type_traits/integral_constant.h>
|
||||
#include <__type_traits/void_t.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
@ -23,11 +22,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER >= 14
|
||||
|
||||
template <class _Tp, class, class = void>
|
||||
struct __is_transparent : false_type {};
|
||||
inline const bool __is_transparent_v = false;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __is_transparent<_Tp, _Up, __void_t<typename _Tp::is_transparent> >
|
||||
: true_type {};
|
||||
inline const bool __is_transparent_v<_Tp, _Up, __void_t<typename _Tp::is_transparent> > = true;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
36
third_party/libcxx/__functional/mem_fn.h
vendored
36
third_party/libcxx/__functional/mem_fn.h
vendored
|
@ -23,34 +23,30 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
class __mem_fn : public __weak_result_type<_Tp>
|
||||
{
|
||||
class __mem_fn : public __weak_result_type<_Tp> {
|
||||
public:
|
||||
// types
|
||||
typedef _Tp type;
|
||||
// types
|
||||
typedef _Tp type;
|
||||
|
||||
private:
|
||||
type __f_;
|
||||
type __f_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
__mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
|
||||
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
|
||||
typename __invoke_return<type, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const {
|
||||
return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
typename __invoke_return<type, _ArgTypes...>::type
|
||||
operator()(_ArgTypes&&... __args) const {
|
||||
return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _Rp, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
__mem_fn<_Rp _Tp::*>
|
||||
mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
|
||||
{
|
||||
return __mem_fn<_Rp _Tp::*>(__pm);
|
||||
template <class _Rp, class _Tp>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn<_Rp _Tp::*> mem_fn(_Rp _Tp::*__pm) _NOEXCEPT {
|
||||
return __mem_fn<_Rp _Tp::*>(__pm);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
|
213
third_party/libcxx/__functional/mem_fun_ref.h
vendored
213
third_party/libcxx/__functional/mem_fun_ref.h
vendored
|
@ -22,149 +22,122 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
|
||||
template<class _Sp, class _Tp>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t
|
||||
: public __unary_function<_Tp*, _Sp>
|
||||
{
|
||||
_Sp (_Tp::*__p_)();
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit mem_fun_t(_Sp (_Tp::*__p)())
|
||||
: __p_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Sp operator()(_Tp* __p) const
|
||||
{return (__p->*__p_)();}
|
||||
};
|
||||
|
||||
template<class _Sp, class _Tp, class _Ap>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t
|
||||
: public __binary_function<_Tp*, _Ap, _Sp>
|
||||
{
|
||||
_Sp (_Tp::*__p_)(_Ap);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit mem_fun1_t(_Sp (_Tp::*__p)(_Ap))
|
||||
: __p_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Sp operator()(_Tp* __p, _Ap __x) const
|
||||
{return (__p->*__p_)(__x);}
|
||||
};
|
||||
|
||||
template<class _Sp, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
mem_fun_t<_Sp,_Tp>
|
||||
mem_fun(_Sp (_Tp::*__f)())
|
||||
{return mem_fun_t<_Sp,_Tp>(__f);}
|
||||
|
||||
template<class _Sp, class _Tp, class _Ap>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
mem_fun1_t<_Sp,_Tp,_Ap>
|
||||
mem_fun(_Sp (_Tp::*__f)(_Ap))
|
||||
{return mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
|
||||
|
||||
template<class _Sp, class _Tp>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t
|
||||
: public __unary_function<_Tp, _Sp>
|
||||
{
|
||||
_Sp (_Tp::*__p_)();
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit mem_fun_ref_t(_Sp (_Tp::*__p)())
|
||||
: __p_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Sp operator()(_Tp& __p) const
|
||||
{return (__p.*__p_)();}
|
||||
};
|
||||
|
||||
template<class _Sp, class _Tp, class _Ap>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t
|
||||
: public __binary_function<_Tp, _Ap, _Sp>
|
||||
{
|
||||
_Sp (_Tp::*__p_)(_Ap);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap))
|
||||
: __p_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Sp operator()(_Tp& __p, _Ap __x) const
|
||||
{return (__p.*__p_)(__x);}
|
||||
};
|
||||
|
||||
template<class _Sp, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
mem_fun_ref_t<_Sp,_Tp>
|
||||
mem_fun_ref(_Sp (_Tp::*__f)())
|
||||
{return mem_fun_ref_t<_Sp,_Tp>(__f);}
|
||||
|
||||
template<class _Sp, class _Tp, class _Ap>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
mem_fun1_ref_t<_Sp,_Tp,_Ap>
|
||||
mem_fun_ref(_Sp (_Tp::*__f)(_Ap))
|
||||
{return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
|
||||
|
||||
template <class _Sp, class _Tp>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t
|
||||
: public __unary_function<const _Tp*, _Sp>
|
||||
{
|
||||
_Sp (_Tp::*__p_)() const;
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t : public __unary_function<_Tp*, _Sp> {
|
||||
_Sp (_Tp::*__p_)();
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit const_mem_fun_t(_Sp (_Tp::*__p)() const)
|
||||
: __p_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Sp operator()(const _Tp* __p) const
|
||||
{return (__p->*__p_)();}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit mem_fun_t(_Sp (_Tp::*__p)()) : __p_(__p) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p) const { return (__p->*__p_)(); }
|
||||
};
|
||||
|
||||
template <class _Sp, class _Tp, class _Ap>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t
|
||||
: public __binary_function<const _Tp*, _Ap, _Sp>
|
||||
{
|
||||
_Sp (_Tp::*__p_)(_Ap) const;
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t : public __binary_function<_Tp*, _Ap, _Sp> {
|
||||
_Sp (_Tp::*__p_)(_Ap);
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit const_mem_fun1_t(_Sp (_Tp::*__p)(_Ap) const)
|
||||
: __p_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Sp operator()(const _Tp* __p, _Ap __x) const
|
||||
{return (__p->*__p_)(__x);}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit mem_fun1_t(_Sp (_Tp::*__p)(_Ap)) : __p_(__p) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p, _Ap __x) const { return (__p->*__p_)(__x); }
|
||||
};
|
||||
|
||||
template <class _Sp, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
const_mem_fun_t<_Sp,_Tp>
|
||||
mem_fun(_Sp (_Tp::*__f)() const)
|
||||
{return const_mem_fun_t<_Sp,_Tp>(__f);}
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun_t<_Sp, _Tp> mem_fun(_Sp (_Tp::*__f)()) {
|
||||
return mem_fun_t<_Sp, _Tp>(__f);
|
||||
}
|
||||
|
||||
template <class _Sp, class _Tp, class _Ap>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
const_mem_fun1_t<_Sp,_Tp,_Ap>
|
||||
mem_fun(_Sp (_Tp::*__f)(_Ap) const)
|
||||
{return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun1_t<_Sp, _Tp, _Ap> mem_fun(_Sp (_Tp::*__f)(_Ap)) {
|
||||
return mem_fun1_t<_Sp, _Tp, _Ap>(__f);
|
||||
}
|
||||
|
||||
template <class _Sp, class _Tp>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t
|
||||
: public __unary_function<_Tp, _Sp>
|
||||
{
|
||||
_Sp (_Tp::*__p_)() const;
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t : public __unary_function<_Tp, _Sp> {
|
||||
_Sp (_Tp::*__p_)();
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit const_mem_fun_ref_t(_Sp (_Tp::*__p)() const)
|
||||
: __p_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Sp operator()(const _Tp& __p) const
|
||||
{return (__p.*__p_)();}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit mem_fun_ref_t(_Sp (_Tp::*__p)()) : __p_(__p) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p) const { return (__p.*__p_)(); }
|
||||
};
|
||||
|
||||
template <class _Sp, class _Tp, class _Ap>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t
|
||||
: public __binary_function<_Tp, _Ap, _Sp>
|
||||
{
|
||||
_Sp (_Tp::*__p_)(_Ap) const;
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t : public __binary_function<_Tp, _Ap, _Sp> {
|
||||
_Sp (_Tp::*__p_)(_Ap);
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit const_mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap) const)
|
||||
: __p_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Sp operator()(const _Tp& __p, _Ap __x) const
|
||||
{return (__p.*__p_)(__x);}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap)) : __p_(__p) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p, _Ap __x) const { return (__p.*__p_)(__x); }
|
||||
};
|
||||
|
||||
template <class _Sp, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
const_mem_fun_ref_t<_Sp,_Tp>
|
||||
mem_fun_ref(_Sp (_Tp::*__f)() const)
|
||||
{return const_mem_fun_ref_t<_Sp,_Tp>(__f);}
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun_ref_t<_Sp, _Tp> mem_fun_ref(_Sp (_Tp::*__f)()) {
|
||||
return mem_fun_ref_t<_Sp, _Tp>(__f);
|
||||
}
|
||||
|
||||
template <class _Sp, class _Tp, class _Ap>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
|
||||
mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
|
||||
{return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun1_ref_t<_Sp, _Tp, _Ap>
|
||||
mem_fun_ref(_Sp (_Tp::*__f)(_Ap)) {
|
||||
return mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f);
|
||||
}
|
||||
|
||||
template <class _Sp, class _Tp>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t : public __unary_function<const _Tp*, _Sp> {
|
||||
_Sp (_Tp::*__p_)() const;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_t(_Sp (_Tp::*__p)() const) : __p_(__p) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p) const { return (__p->*__p_)(); }
|
||||
};
|
||||
|
||||
template <class _Sp, class _Tp, class _Ap>
|
||||
class _LIBCPP_TEMPLATE_VIS
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t : public __binary_function<const _Tp*, _Ap, _Sp> {
|
||||
_Sp (_Tp::*__p_)(_Ap) const;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_t(_Sp (_Tp::*__p)(_Ap) const) : __p_(__p) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p, _Ap __x) const { return (__p->*__p_)(__x); }
|
||||
};
|
||||
|
||||
template <class _Sp, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun_t<_Sp, _Tp> mem_fun(_Sp (_Tp::*__f)() const) {
|
||||
return const_mem_fun_t<_Sp, _Tp>(__f);
|
||||
}
|
||||
|
||||
template <class _Sp, class _Tp, class _Ap>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun1_t<_Sp, _Tp, _Ap>
|
||||
mem_fun(_Sp (_Tp::*__f)(_Ap) const) {
|
||||
return const_mem_fun1_t<_Sp, _Tp, _Ap>(__f);
|
||||
}
|
||||
|
||||
template <class _Sp, class _Tp>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t : public __unary_function<_Tp, _Sp> {
|
||||
_Sp (_Tp::*__p_)() const;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_ref_t(_Sp (_Tp::*__p)() const) : __p_(__p) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p) const { return (__p.*__p_)(); }
|
||||
};
|
||||
|
||||
template <class _Sp, class _Tp, class _Ap>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t : public __binary_function<_Tp, _Ap, _Sp> {
|
||||
_Sp (_Tp::*__p_)(_Ap) const;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap) const) : __p_(__p) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p, _Ap __x) const { return (__p.*__p_)(__x); }
|
||||
};
|
||||
|
||||
template <class _Sp, class _Tp>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun_ref_t<_Sp, _Tp>
|
||||
mem_fun_ref(_Sp (_Tp::*__f)() const) {
|
||||
return const_mem_fun_ref_t<_Sp, _Tp>(__f);
|
||||
}
|
||||
|
||||
template <class _Sp, class _Tp, class _Ap>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun1_ref_t<_Sp, _Tp, _Ap>
|
||||
mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) {
|
||||
return const_mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
|
||||
|
|
26
third_party/libcxx/__functional/not_fn.h
vendored
26
third_party/libcxx/__functional/not_fn.h
vendored
|
@ -16,7 +16,6 @@
|
|||
#include <__type_traits/decay.h>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/is_constructible.h>
|
||||
#include <__type_traits/is_move_constructible.h>
|
||||
#include <__utility/forward.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
@ -28,26 +27,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
struct __not_fn_op {
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 auto operator()(_Args&&... __args) const
|
||||
noexcept(noexcept(!_VSTD::invoke(_VSTD::forward<_Args>(__args)...)))
|
||||
-> decltype( !_VSTD::invoke(_VSTD::forward<_Args>(__args)...))
|
||||
{ return !_VSTD::invoke(_VSTD::forward<_Args>(__args)...); }
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto operator()(_Args&&... __args) const
|
||||
noexcept(noexcept(!std::invoke(std::forward<_Args>(__args)...)))
|
||||
-> decltype(!std::invoke(std::forward<_Args>(__args)...)) {
|
||||
return !std::invoke(std::forward<_Args>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Fn>
|
||||
struct __not_fn_t : __perfect_forward<__not_fn_op, _Fn> {
|
||||
using __perfect_forward<__not_fn_op, _Fn>::__perfect_forward;
|
||||
using __perfect_forward<__not_fn_op, _Fn>::__perfect_forward;
|
||||
};
|
||||
|
||||
template <class _Fn, class = enable_if_t<
|
||||
is_constructible_v<decay_t<_Fn>, _Fn> &&
|
||||
is_move_constructible_v<decay_t<_Fn>>
|
||||
>>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) {
|
||||
return __not_fn_t<decay_t<_Fn>>(_VSTD::forward<_Fn>(__f));
|
||||
template <class _Fn,
|
||||
class = enable_if_t< is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> >>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) {
|
||||
return __not_fn_t<decay_t<_Fn>>(std::forward<_Fn>(__f));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
|
571
third_party/libcxx/__functional/operations.h
vendored
571
third_party/libcxx/__functional/operations.h
vendored
|
@ -13,8 +13,7 @@
|
|||
#include <__config>
|
||||
#include <__functional/binary_function.h>
|
||||
#include <__functional/unary_function.h>
|
||||
#include <__type_traits/integral_constant.h>
|
||||
#include <__type_traits/predicate_traits.h>
|
||||
#include <__type_traits/desugars_to.h>
|
||||
#include <__utility/forward.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
@ -30,27 +29,32 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS plus : __binary_function<_Tp, _Tp, _Tp> {
|
||||
typedef _Tp __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x + __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus);
|
||||
|
||||
// The non-transparent std::plus specialization is only equivalent to a raw plus
|
||||
// operator when we don't perform an implicit conversion when calling it.
|
||||
template <class _Tp>
|
||||
inline const bool __desugars_to_v<__plus_tag, plus<_Tp>, _Tp, _Tp> = true;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
inline const bool __desugars_to_v<__plus_tag, plus<void>, _Tp, _Up> = true;
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS plus<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) + std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) + std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -59,27 +63,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS minus : __binary_function<_Tp, _Tp, _Tp> {
|
||||
typedef _Tp __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x - __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS minus<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) - std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) - std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -88,27 +89,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS multiplies : __binary_function<_Tp, _Tp, _Tp> {
|
||||
typedef _Tp __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x * __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS multiplies<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) * std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) * std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -117,27 +115,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS divides : __binary_function<_Tp, _Tp, _Tp> {
|
||||
typedef _Tp __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x / __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS divides<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) / std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) / std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -146,27 +141,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS modulus : __binary_function<_Tp, _Tp, _Tp> {
|
||||
typedef _Tp __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x % __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS modulus<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) % std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) % std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -175,27 +167,22 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS negate : __unary_function<_Tp, _Tp> {
|
||||
typedef _Tp __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return -__x; }
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS negate<void> {
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
|
||||
noexcept(noexcept(-std::forward<_Tp>(__x))) //
|
||||
-> decltype(-std::forward<_Tp>(__x)) {
|
||||
return -std::forward<_Tp>(__x);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -206,51 +193,43 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS bit_and : __binary_function<_Tp, _Tp, _Tp> {
|
||||
typedef _Tp __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x & __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS bit_and<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) &
|
||||
std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) & std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) & std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS bit_not : __unary_function<_Tp, _Tp> {
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _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;
|
||||
struct _LIBCPP_TEMPLATE_VIS bit_not<void> {
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
|
||||
noexcept(noexcept(~std::forward<_Tp>(__x))) //
|
||||
-> decltype(~std::forward<_Tp>(__x)) {
|
||||
return ~std::forward<_Tp>(__x);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -259,27 +238,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS bit_or : __binary_function<_Tp, _Tp, _Tp> {
|
||||
typedef _Tp __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x | __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS bit_or<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) | std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) | std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -288,27 +264,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS bit_xor : __binary_function<_Tp, _Tp, _Tp> {
|
||||
typedef _Tp __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x ^ __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS bit_xor<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) ^ std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -319,64 +292,59 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS equal_to : __binary_function<_Tp, _Tp, bool> {
|
||||
typedef bool __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x == __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS equal_to<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) == std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) == std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
// The non-transparent std::equal_to specialization is only equivalent to a raw equality
|
||||
// comparison when we don't perform an implicit conversion when calling it.
|
||||
template <class _Tp>
|
||||
struct __is_trivial_equality_predicate<equal_to<_Tp>, _Tp, _Tp> : true_type {};
|
||||
inline const bool __desugars_to_v<__equal_tag, equal_to<_Tp>, _Tp, _Tp> = true;
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
template <class _Tp>
|
||||
struct __is_trivial_equality_predicate<equal_to<>, _Tp, _Tp> : true_type {};
|
||||
#endif
|
||||
// In the transparent case, we do not enforce that
|
||||
template <class _Tp, class _Up>
|
||||
inline const bool __desugars_to_v<__equal_tag, equal_to<void>, _Tp, _Up> = true;
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS not_equal_to : __binary_function<_Tp, _Tp, bool> {
|
||||
typedef bool __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x != __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) != std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) != std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -385,28 +353,31 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS less : __binary_function<_Tp, _Tp, bool> {
|
||||
typedef bool __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x < __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less);
|
||||
|
||||
template <class _Tp>
|
||||
inline const bool __desugars_to_v<__less_tag, less<_Tp>, _Tp, _Tp> = true;
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS less<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) < std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) < std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
inline const bool __desugars_to_v<__less_tag, less<>, _Tp, _Tp> = true;
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
|
@ -414,27 +385,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS less_equal : __binary_function<_Tp, _Tp, bool> {
|
||||
typedef bool __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x <= __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS less_equal<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) <= std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) <= std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -443,27 +411,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS greater_equal : __binary_function<_Tp, _Tp, bool> {
|
||||
typedef bool __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x >= __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS greater_equal<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) >=
|
||||
std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) >= std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) >= std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -472,27 +437,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS greater : __binary_function<_Tp, _Tp, bool> {
|
||||
typedef bool __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x > __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS greater<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) > std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) > std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -503,27 +465,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS logical_and : __binary_function<_Tp, _Tp, bool> {
|
||||
typedef bool __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x && __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS logical_and<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) && std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) && std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -532,27 +491,22 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS logical_not : __unary_function<_Tp, bool> {
|
||||
typedef bool __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x) const { return !__x; }
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS logical_not<void> {
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
|
||||
noexcept(noexcept(!std::forward<_Tp>(__x))) //
|
||||
-> decltype(!std::forward<_Tp>(__x)) {
|
||||
return !std::forward<_Tp>(__x);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -561,27 +515,24 @@ 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;}
|
||||
struct _LIBCPP_TEMPLATE_VIS logical_or : __binary_function<_Tp, _Tp, bool> {
|
||||
typedef bool __result_type; // used by valarray
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x || __y;
|
||||
}
|
||||
};
|
||||
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
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;
|
||||
struct _LIBCPP_TEMPLATE_VIS logical_or<void> {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
|
||||
noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u))) //
|
||||
-> decltype(std::forward<_T1>(__t) || std::forward<_T2>(__u)) {
|
||||
return std::forward<_T1>(__t) || std::forward<_T2>(__u);
|
||||
}
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,8 +11,12 @@
|
|||
#define _LIBCPP___FUNCTIONAL_PERFECT_FORWARD_H
|
||||
|
||||
#include <__config>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/invoke.h>
|
||||
#include <__type_traits/is_constructible.h>
|
||||
#include <__utility/declval.h>
|
||||
#include <__utility/forward.h>
|
||||
#include <__utility/integer_sequence.h>
|
||||
#include <__utility/move.h>
|
||||
#include <tuple>
|
||||
|
||||
|
@ -20,6 +24,9 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
@ -33,61 +40,65 @@ private:
|
|||
tuple<_BoundArgs...> __bound_args_;
|
||||
|
||||
public:
|
||||
template <class... _Args, class = enable_if_t<
|
||||
is_constructible_v<tuple<_BoundArgs...>, _Args&&...>
|
||||
>>
|
||||
template <class... _Args, class = enable_if_t< is_constructible_v<tuple<_BoundArgs...>, _Args&&...> >>
|
||||
_LIBCPP_HIDE_FROM_ABI explicit constexpr __perfect_forward_impl(_Args&&... __bound_args)
|
||||
: __bound_args_(_VSTD::forward<_Args>(__bound_args)...) {}
|
||||
: __bound_args_(std::forward<_Args>(__bound_args)...) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl&&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl&&) = default;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
|
||||
|
||||
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &
|
||||
noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...)))
|
||||
-> decltype( _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...))
|
||||
{ return _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...); }
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) & noexcept(
|
||||
noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
|
||||
-> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
|
||||
return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
|
||||
auto operator()(_Args&&...) & = delete;
|
||||
|
||||
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&
|
||||
noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...)))
|
||||
-> decltype( _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...))
|
||||
{ return _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...); }
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const& noexcept(
|
||||
noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
|
||||
-> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
|
||||
return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
|
||||
auto operator()(_Args&&...) const& = delete;
|
||||
|
||||
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs..., _Args...>>>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &&
|
||||
noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...)))
|
||||
-> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...))
|
||||
{ return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...); }
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) && noexcept(
|
||||
noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
|
||||
-> decltype(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)) {
|
||||
return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs..., _Args...>>>
|
||||
auto operator()(_Args&&...) && = delete;
|
||||
|
||||
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&&
|
||||
noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...)))
|
||||
-> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...))
|
||||
{ return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...); }
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&& noexcept(
|
||||
noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
|
||||
-> decltype(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)) {
|
||||
return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
|
||||
auto operator()(_Args&&...) const&& = delete;
|
||||
};
|
||||
|
||||
// __perfect_forward implements a perfect-forwarding call wrapper as explained in [func.require].
|
||||
template <class _Op, class ..._Args>
|
||||
template <class _Op, class... _Args>
|
||||
using __perfect_forward = __perfect_forward_impl<_Op, index_sequence_for<_Args...>, _Args...>;
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___FUNCTIONAL_PERFECT_FORWARD_H
|
||||
|
|
|
@ -22,22 +22,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function
|
||||
: public __binary_function<_Arg1, _Arg2, _Result>
|
||||
{
|
||||
_Result (*__f_)(_Arg1, _Arg2);
|
||||
class _LIBCPP_TEMPLATE_VIS
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function : public __binary_function<_Arg1, _Arg2, _Result> {
|
||||
_Result (*__f_)(_Arg1, _Arg2);
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit pointer_to_binary_function(_Result (*__f)(_Arg1, _Arg2))
|
||||
: __f_(__f) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Result operator()(_Arg1 __x, _Arg2 __y) const
|
||||
{return __f_(__x, __y);}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit pointer_to_binary_function(_Result (*__f)(_Arg1, _Arg2)) : __f_(__f) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg1 __x, _Arg2 __y) const { return __f_(__x, __y); }
|
||||
};
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
pointer_to_binary_function<_Arg1,_Arg2,_Result>
|
||||
ptr_fun(_Result (*__f)(_Arg1,_Arg2))
|
||||
{return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);}
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI pointer_to_binary_function<_Arg1, _Arg2, _Result>
|
||||
ptr_fun(_Result (*__f)(_Arg1, _Arg2)) {
|
||||
return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__f);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,22 +22,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function
|
||||
: public __unary_function<_Arg, _Result>
|
||||
{
|
||||
_Result (*__f_)(_Arg);
|
||||
class _LIBCPP_TEMPLATE_VIS
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function : public __unary_function<_Arg, _Result> {
|
||||
_Result (*__f_)(_Arg);
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit pointer_to_unary_function(_Result (*__f)(_Arg))
|
||||
: __f_(__f) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Result operator()(_Arg __x) const
|
||||
{return __f_(__x);}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit pointer_to_unary_function(_Result (*__f)(_Arg)) : __f_(__f) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg __x) const { return __f_(__x); }
|
||||
};
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
|
||||
pointer_to_unary_function<_Arg,_Result>
|
||||
ptr_fun(_Result (*__f)(_Arg))
|
||||
{return pointer_to_unary_function<_Arg,_Result>(__f);}
|
||||
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI pointer_to_unary_function<_Arg, _Result>
|
||||
ptr_fun(_Result (*__f)(_Arg)) {
|
||||
return pointer_to_unary_function<_Arg, _Result>(__f);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
#include <__concepts/equality_comparable.h>
|
||||
#include <__concepts/totally_ordered.h>
|
||||
#include <__config>
|
||||
#include <__type_traits/integral_constant.h>
|
||||
#include <__type_traits/predicate_traits.h>
|
||||
#include <__type_traits/desugars_to.h>
|
||||
#include <__utility/forward.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
@ -29,10 +28,10 @@ namespace ranges {
|
|||
|
||||
struct equal_to {
|
||||
template <class _Tp, class _Up>
|
||||
requires equality_comparable_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
|
||||
noexcept(noexcept(bool(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u)))) {
|
||||
return _VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u);
|
||||
requires equality_comparable_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
|
||||
noexcept(noexcept(bool(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))) {
|
||||
return std::forward<_Tp>(__t) == std::forward<_Up>(__u);
|
||||
}
|
||||
|
||||
using is_transparent = void;
|
||||
|
@ -40,10 +39,10 @@ struct equal_to {
|
|||
|
||||
struct not_equal_to {
|
||||
template <class _Tp, class _Up>
|
||||
requires equality_comparable_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
|
||||
noexcept(noexcept(bool(!(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u))))) {
|
||||
return !(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u));
|
||||
requires equality_comparable_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
|
||||
noexcept(noexcept(bool(!(std::forward<_Tp>(__t) == std::forward<_Up>(__u))))) {
|
||||
return !(std::forward<_Tp>(__t) == std::forward<_Up>(__u));
|
||||
}
|
||||
|
||||
using is_transparent = void;
|
||||
|
@ -51,10 +50,10 @@ struct not_equal_to {
|
|||
|
||||
struct less {
|
||||
template <class _Tp, class _Up>
|
||||
requires totally_ordered_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
|
||||
noexcept(noexcept(bool(_VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u)))) {
|
||||
return _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u);
|
||||
requires totally_ordered_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
|
||||
noexcept(noexcept(bool(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))) {
|
||||
return std::forward<_Tp>(__t) < std::forward<_Up>(__u);
|
||||
}
|
||||
|
||||
using is_transparent = void;
|
||||
|
@ -62,10 +61,10 @@ struct less {
|
|||
|
||||
struct less_equal {
|
||||
template <class _Tp, class _Up>
|
||||
requires totally_ordered_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
|
||||
noexcept(noexcept(bool(!(_VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t))))) {
|
||||
return !(_VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t));
|
||||
requires totally_ordered_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
|
||||
noexcept(noexcept(bool(!(std::forward<_Up>(__u) < std::forward<_Tp>(__t))))) {
|
||||
return !(std::forward<_Up>(__u) < std::forward<_Tp>(__t));
|
||||
}
|
||||
|
||||
using is_transparent = void;
|
||||
|
@ -73,10 +72,10 @@ struct less_equal {
|
|||
|
||||
struct greater {
|
||||
template <class _Tp, class _Up>
|
||||
requires totally_ordered_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
|
||||
noexcept(noexcept(bool(_VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t)))) {
|
||||
return _VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t);
|
||||
requires totally_ordered_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
|
||||
noexcept(noexcept(bool(std::forward<_Up>(__u) < std::forward<_Tp>(__t)))) {
|
||||
return std::forward<_Up>(__u) < std::forward<_Tp>(__t);
|
||||
}
|
||||
|
||||
using is_transparent = void;
|
||||
|
@ -84,10 +83,10 @@ struct greater {
|
|||
|
||||
struct greater_equal {
|
||||
template <class _Tp, class _Up>
|
||||
requires totally_ordered_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
|
||||
noexcept(noexcept(bool(!(_VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u))))) {
|
||||
return !(_VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u));
|
||||
requires totally_ordered_with<_Tp, _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
|
||||
noexcept(noexcept(bool(!(std::forward<_Tp>(__t) < std::forward<_Up>(__u))))) {
|
||||
return !(std::forward<_Tp>(__t) < std::forward<_Up>(__u));
|
||||
}
|
||||
|
||||
using is_transparent = void;
|
||||
|
@ -95,8 +94,13 @@ struct greater_equal {
|
|||
|
||||
} // namespace ranges
|
||||
|
||||
template <class _Lhs, class _Rhs>
|
||||
struct __is_trivial_equality_predicate<ranges::equal_to, _Lhs, _Rhs> : true_type {};
|
||||
// For ranges we do not require that the types on each side of the equality
|
||||
// operator are of the same type
|
||||
template <class _Tp, class _Up>
|
||||
inline const bool __desugars_to_v<__equal_tag, ranges::equal_to, _Tp, _Up> = true;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
inline const bool __desugars_to_v<__less_tag, ranges::less, _Tp, _Up> = true;
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 20
|
||||
|
||||
|
|
143
third_party/libcxx/__functional/reference_wrapper.h
vendored
143
third_party/libcxx/__functional/reference_wrapper.h
vendored
|
@ -10,12 +10,16 @@
|
|||
#ifndef _LIBCPP___FUNCTIONAL_REFERENCE_WRAPPER_H
|
||||
#define _LIBCPP___FUNCTIONAL_REFERENCE_WRAPPER_H
|
||||
|
||||
#include <__compare/synth_three_way.h>
|
||||
#include <__concepts/boolean_testable.h>
|
||||
#include <__config>
|
||||
#include <__functional/invoke.h>
|
||||
#include <__functional/weak_result_type.h>
|
||||
#include <__memory/addressof.h>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/is_const.h>
|
||||
#include <__type_traits/remove_cvref.h>
|
||||
#include <__type_traits/void_t.h>
|
||||
#include <__utility/declval.h>
|
||||
#include <__utility/forward.h>
|
||||
|
||||
|
@ -26,44 +30,91 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp>
|
||||
{
|
||||
class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp> {
|
||||
public:
|
||||
// types
|
||||
typedef _Tp type;
|
||||
// types
|
||||
typedef _Tp type;
|
||||
|
||||
private:
|
||||
type* __f_;
|
||||
type* __f_;
|
||||
|
||||
static void __fun(_Tp&) _NOEXCEPT;
|
||||
static void __fun(_Tp&&) = delete;
|
||||
static void __fun(_Tp&) _NOEXCEPT;
|
||||
static void __fun(_Tp&&) = delete; // NOLINT(modernize-use-equals-delete) ; This is llvm.org/PR54276
|
||||
|
||||
public:
|
||||
template <class _Up, class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(std::declval<_Up>())) > >
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) {
|
||||
type& __f = static_cast<_Up&&>(__u);
|
||||
__f_ = _VSTD::addressof(__f);
|
||||
}
|
||||
template <class _Up,
|
||||
class = __void_t<decltype(__fun(std::declval<_Up>()))>,
|
||||
__enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper(_Up&& __u)
|
||||
_NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) {
|
||||
type& __f = static_cast<_Up&&>(__u);
|
||||
__f_ = std::addressof(__f);
|
||||
}
|
||||
|
||||
// access
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
operator type&() const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
type& get() const _NOEXCEPT {return *__f_;}
|
||||
// access
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator type&() const _NOEXCEPT { return *__f_; }
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 type& get() const _NOEXCEPT { return *__f_; }
|
||||
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator()(_ArgTypes&&... __args) const
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
// Since is_nothrow_invocable requires C++17 LWG3764 is not backported
|
||||
// to earlier versions.
|
||||
noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>)
|
||||
// Since is_nothrow_invocable requires C++17 LWG3764 is not backported
|
||||
// to earlier versions.
|
||||
noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>)
|
||||
#endif
|
||||
{
|
||||
return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
|
||||
{
|
||||
return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER >= 26
|
||||
|
||||
// [refwrap.comparisons], comparisons
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(reference_wrapper __x, reference_wrapper __y)
|
||||
requires requires {
|
||||
{ __x.get() == __y.get() } -> __boolean_testable;
|
||||
}
|
||||
{
|
||||
return __x.get() == __y.get();
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(reference_wrapper __x, const _Tp& __y)
|
||||
requires requires {
|
||||
{ __x.get() == __y } -> __boolean_testable;
|
||||
}
|
||||
{
|
||||
return __x.get() == __y;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(reference_wrapper __x, reference_wrapper<const _Tp> __y)
|
||||
requires(!is_const_v<_Tp>) && requires {
|
||||
{ __x.get() == __y.get() } -> __boolean_testable;
|
||||
}
|
||||
{
|
||||
return __x.get() == __y.get();
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(reference_wrapper __x, reference_wrapper __y)
|
||||
requires requires { std::__synth_three_way(__x.get(), __y.get()); }
|
||||
{
|
||||
return std::__synth_three_way(__x.get(), __y.get());
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(reference_wrapper __x, const _Tp& __y)
|
||||
requires requires { std::__synth_three_way(__x.get(), __y); }
|
||||
{
|
||||
return std::__synth_three_way(__x.get(), __y);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(reference_wrapper __x, reference_wrapper<const _Tp> __y)
|
||||
requires(!is_const_v<_Tp>) && requires { std::__synth_three_way(__x.get(), __y.get()); }
|
||||
{
|
||||
return std::__synth_three_way(__x.get(), __y.get());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 26
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
@ -72,39 +123,31 @@ reference_wrapper(_Tp&) -> reference_wrapper<_Tp>;
|
|||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
reference_wrapper<_Tp>
|
||||
ref(_Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<_Tp>(__t);
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp> ref(_Tp& __t) _NOEXCEPT {
|
||||
return reference_wrapper<_Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
reference_wrapper<_Tp>
|
||||
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return __t;
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp>
|
||||
ref(reference_wrapper<_Tp> __t) _NOEXCEPT {
|
||||
return __t;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
reference_wrapper<const _Tp>
|
||||
cref(const _Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<const _Tp>(__t);
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp> cref(const _Tp& __t) _NOEXCEPT {
|
||||
return reference_wrapper<const _Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
reference_wrapper<const _Tp>
|
||||
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return __t;
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp>
|
||||
cref(reference_wrapper<_Tp> __t) _NOEXCEPT {
|
||||
return __t;
|
||||
}
|
||||
|
||||
template <class _Tp> void ref(const _Tp&&) = delete;
|
||||
template <class _Tp> void cref(const _Tp&&) = delete;
|
||||
template <class _Tp>
|
||||
void ref(const _Tp&&) = delete;
|
||||
template <class _Tp>
|
||||
void cref(const _Tp&&) = delete;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
12
third_party/libcxx/__functional/unary_function.h
vendored
12
third_party/libcxx/__functional/unary_function.h
vendored
|
@ -20,18 +20,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function
|
||||
{
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function {
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 14
|
||||
|
||||
template <class _Arg, class _Result> struct __unary_function_keep_layout_base {
|
||||
template <class _Arg, class _Result>
|
||||
struct __unary_function_keep_layout_base {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg;
|
||||
using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
|
||||
using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
27
third_party/libcxx/__functional/unary_negate.h
vendored
27
third_party/libcxx/__functional/unary_negate.h
vendored
|
@ -22,23 +22,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
|
||||
|
||||
template <class _Predicate>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate
|
||||
: public __unary_function<typename _Predicate::argument_type, bool>
|
||||
{
|
||||
_Predicate __pred_;
|
||||
class _LIBCPP_TEMPLATE_VIS
|
||||
_LIBCPP_DEPRECATED_IN_CXX17 unary_negate : public __unary_function<typename _Predicate::argument_type, bool> {
|
||||
_Predicate __pred_;
|
||||
|
||||
public:
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
|
||||
explicit unary_negate(const _Predicate& __pred)
|
||||
: __pred_(__pred) {}
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Predicate::argument_type& __x) const
|
||||
{return !__pred_(__x);}
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI explicit unary_negate(const _Predicate& __pred)
|
||||
: __pred_(__pred) {}
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
|
||||
operator()(const typename _Predicate::argument_type& __x) const {
|
||||
return !__pred_(__x);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Predicate>
|
||||
_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
|
||||
unary_negate<_Predicate>
|
||||
not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);}
|
||||
_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI unary_negate<_Predicate>
|
||||
not1(const _Predicate& __pred) {
|
||||
return unary_negate<_Predicate>(__pred);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
|
||||
|
||||
|
|
225
third_party/libcxx/__functional/weak_result_type.h
vendored
225
third_party/libcxx/__functional/weak_result_type.h
vendored
|
@ -25,268 +25,205 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_result_type
|
||||
{
|
||||
struct __has_result_type {
|
||||
private:
|
||||
template <class _Up> static false_type __test(...);
|
||||
template <class _Up> static true_type __test(typename _Up::result_type* = 0);
|
||||
template <class _Up>
|
||||
static false_type __test(...);
|
||||
template <class _Up>
|
||||
static true_type __test(typename _Up::result_type* = 0);
|
||||
|
||||
public:
|
||||
static const bool value = decltype(__test<_Tp>(0))::value;
|
||||
static const bool value = decltype(__test<_Tp>(0))::value;
|
||||
};
|
||||
|
||||
// __weak_result_type
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_unary_function
|
||||
{
|
||||
struct __derives_from_unary_function {
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
static __two __test(...);
|
||||
template <class _Ap, class _Rp>
|
||||
static __unary_function<_Ap, _Rp>
|
||||
__test(const volatile __unary_function<_Ap, _Rp>*);
|
||||
struct __two {
|
||||
char __lx;
|
||||
char __lxx;
|
||||
};
|
||||
static __two __test(...);
|
||||
template <class _Ap, class _Rp>
|
||||
static __unary_function<_Ap, _Rp> __test(const volatile __unary_function<_Ap, _Rp>*);
|
||||
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_binary_function
|
||||
{
|
||||
struct __derives_from_binary_function {
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
static __two __test(...);
|
||||
template <class _A1, class _A2, class _Rp>
|
||||
static __binary_function<_A1, _A2, _Rp>
|
||||
__test(const volatile __binary_function<_A1, _A2, _Rp>*);
|
||||
struct __two {
|
||||
char __lx;
|
||||
char __lxx;
|
||||
};
|
||||
static __two __test(...);
|
||||
template <class _A1, class _A2, class _Rp>
|
||||
static __binary_function<_A1, _A2, _Rp> __test(const volatile __binary_function<_A1, _A2, _Rp>*);
|
||||
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_unary_function // bool is true
|
||||
: public __derives_from_unary_function<_Tp>::type
|
||||
{
|
||||
};
|
||||
struct __maybe_derive_from_unary_function // bool is true
|
||||
: public __derives_from_unary_function<_Tp>::type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_unary_function<_Tp, false>
|
||||
{
|
||||
};
|
||||
struct __maybe_derive_from_unary_function<_Tp, false> {};
|
||||
|
||||
template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_binary_function // bool is true
|
||||
: public __derives_from_binary_function<_Tp>::type
|
||||
{
|
||||
};
|
||||
struct __maybe_derive_from_binary_function // bool is true
|
||||
: public __derives_from_binary_function<_Tp>::type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_binary_function<_Tp, false>
|
||||
{
|
||||
};
|
||||
struct __maybe_derive_from_binary_function<_Tp, false> {};
|
||||
|
||||
template <class _Tp, bool = __has_result_type<_Tp>::value>
|
||||
struct __weak_result_type_imp // bool is true
|
||||
: public __maybe_derive_from_unary_function<_Tp>,
|
||||
public __maybe_derive_from_binary_function<_Tp>
|
||||
{
|
||||
public __maybe_derive_from_binary_function<_Tp> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = typename _Tp::result_type;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = typename _Tp::result_type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type_imp<_Tp, false>
|
||||
: public __maybe_derive_from_unary_function<_Tp>,
|
||||
public __maybe_derive_from_binary_function<_Tp>
|
||||
{
|
||||
};
|
||||
: public __maybe_derive_from_unary_function<_Tp>, public __maybe_derive_from_binary_function<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type
|
||||
: public __weak_result_type_imp<_Tp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type : public __weak_result_type_imp<_Tp> {};
|
||||
|
||||
// 0 argument case
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp ()>
|
||||
{
|
||||
struct __weak_result_type<_Rp()> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (&)()>
|
||||
{
|
||||
struct __weak_result_type<_Rp (&)()> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (*)()>
|
||||
{
|
||||
struct __weak_result_type<_Rp (*)()> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
// 1 argument case
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (_A1)>
|
||||
: public __unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp(_A1)> : public __unary_function<_A1, _Rp> {};
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (&)(_A1)>
|
||||
: public __unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (&)(_A1)> : public __unary_function<_A1, _Rp> {};
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (*)(_A1)>
|
||||
: public __unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (*)(_A1)> : public __unary_function<_A1, _Rp> {};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)()>
|
||||
: public __unary_function<_Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (_Cp::*)()> : public __unary_function<_Cp*, _Rp> {};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const>
|
||||
: public __unary_function<const _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const> : public __unary_function<const _Cp*, _Rp> {};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() volatile>
|
||||
: public __unary_function<volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (_Cp::*)() volatile> : public __unary_function<volatile _Cp*, _Rp> {};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
|
||||
: public __unary_function<const volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const volatile> : public __unary_function<const volatile _Cp*, _Rp> {};
|
||||
|
||||
// 2 argument case
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (_A1, _A2)>
|
||||
: public __binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2)>
|
||||
: public __binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2)>
|
||||
: public __binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
|
||||
: public __binary_function<_Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1)> : public __binary_function<_Cp*, _A1, _Rp> {};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
|
||||
: public __binary_function<const _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const> : public __binary_function<const _Cp*, _A1, _Rp> {};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
|
||||
: public __binary_function<volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> : public __binary_function<volatile _Cp*, _A1, _Rp> {};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
|
||||
: public __binary_function<const volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> : public __binary_function<const volatile _Cp*, _A1, _Rp> {
|
||||
};
|
||||
|
||||
// 3 or more arguments
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
|
||||
struct __weak_result_type<_Rp(_A1, _A2, _A3, _A4...)> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
|
||||
{
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
|
||||
{
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
|
||||
{
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
||||
{
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> {
|
||||
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Tp, class ..._Args>
|
||||
struct __invoke_return
|
||||
{
|
||||
typedef decltype(_VSTD::__invoke(std::declval<_Tp>(), std::declval<_Args>()...)) type;
|
||||
template <class _Tp, class... _Args>
|
||||
struct __invoke_return {
|
||||
typedef decltype(std::__invoke(std::declval<_Tp>(), std::declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue