23
24
_LIBCPP_BEGIN_NAMESPACE_STD
25
26
template <class _Arg, class _Result>
26
struct _LIBCPP_TYPE_VIS unary_function
27
struct _LIBCPP_TYPE_VIS_ONLY unary_function
28
29
typedef _Arg argument_type;
29
30
typedef _Result result_type;
32
33
template <class _Arg1, class _Arg2, class _Result>
33
struct _LIBCPP_TYPE_VIS binary_function
34
struct _LIBCPP_TYPE_VIS_ONLY binary_function
35
36
typedef _Arg1 first_argument_type;
36
37
typedef _Arg2 second_argument_type;
37
38
typedef _Result result_type;
40
template <class _Tp> struct _LIBCPP_TYPE_VIS hash;
41
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
42
43
template <class _Tp>
43
44
struct __has_result_type
56
57
template <class _Tp>
58
struct _LIBCPP_TYPE_VIS less : binary_function<_Tp, _Tp, bool>
59
struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
60
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
61
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
62
bool operator()(const _Tp& __x, const _Tp& __y) const
61
63
{return __x < __y;}
64
66
#if _LIBCPP_STD_VER > 11
66
struct _LIBCPP_TYPE_VIS less<void>
68
struct _LIBCPP_TYPE_VIS_ONLY less<void>
68
template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
70
template <class _T1, class _T2>
71
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
69
72
auto operator()(_T1&& __t, _T2&& __u) const
70
73
{ return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
74
typedef void is_transparent;
81
inline _LIBCPP_INLINE_VISIBILITY
83
addressof(_Tp& __x) _NOEXCEPT
85
return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
88
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
89
// Objective-C++ Automatic Reference Counting uses qualified pointers
90
// that require special addressof() signatures. When
91
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
92
// itself is providing these definitions. Otherwise, we provide them.
94
inline _LIBCPP_INLINE_VISIBILITY
96
addressof(__strong _Tp& __x) _NOEXCEPT
101
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
103
inline _LIBCPP_INLINE_VISIBILITY
105
addressof(__weak _Tp& __x) _NOEXCEPT
112
inline _LIBCPP_INLINE_VISIBILITY
114
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
120
inline _LIBCPP_INLINE_VISIBILITY
121
__unsafe_unretained _Tp*
122
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
74
128
#ifdef _LIBCPP_HAS_NO_VARIADICS
76
130
#include <__functional_base_03>
451
506
#endif // _LIBCPP_HAS_NO_VARIADICS
508
#if _LIBCPP_STD_VER > 11
509
template <class _Tp1, class _Tp2 = void>
510
struct __is_transparent
513
struct __two {char __lx; char __lxx;};
514
template <class _Up> static __two __test(...);
515
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
517
static const bool value = sizeof(__test<_Tp1>(0)) == 1;
523
struct _LIBCPP_TYPE_VIS_ONLY allocator_arg_t { };
525
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
526
extern const allocator_arg_t allocator_arg;
528
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
534
struct __has_allocator_type
537
struct __two {char __lx; char __lxx;};
538
template <class _Up> static __two __test(...);
539
template <class _Up> static char __test(typename _Up::allocator_type* = 0);
541
static const bool value = sizeof(__test<_Tp>(0)) == 1;
544
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
545
struct __uses_allocator
546
: public integral_constant<bool,
547
is_convertible<_Alloc, typename _Tp::allocator_type>::value>
551
template <class _Tp, class _Alloc>
552
struct __uses_allocator<_Tp, _Alloc, false>
557
template <class _Tp, class _Alloc>
558
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator
559
: public __uses_allocator<_Tp, _Alloc>
563
#ifndef _LIBCPP_HAS_NO_VARIADICS
565
// allocator construction
567
template <class _Tp, class _Alloc, class ..._Args>
568
struct __uses_alloc_ctor_imp
570
static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
571
static const bool __ic =
572
is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
573
static const int value = __ua ? 2 - __ic : 0;
576
template <class _Tp, class _Alloc, class ..._Args>
577
struct __uses_alloc_ctor
578
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
581
template <class _Tp, class _Allocator, class... _Args>
582
inline _LIBCPP_INLINE_VISIBILITY
583
void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
585
new (__storage) _Tp (_VSTD::forward<_Args>(__args)...);
588
template <class _Tp, class _Allocator, class... _Args>
589
inline _LIBCPP_INLINE_VISIBILITY
590
void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
592
new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...);
595
template <class _Tp, class _Allocator, class... _Args>
596
inline _LIBCPP_INLINE_VISIBILITY
597
void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
599
new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
602
template <class _Tp, class _Allocator, class... _Args>
603
inline _LIBCPP_INLINE_VISIBILITY
604
void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
606
__user_alloc_construct_impl(
607
__uses_alloc_ctor<_Tp, _Allocator>(),
608
__storage, __a, _VSTD::forward<_Args>(__args)...
611
#endif // _LIBCPP_HAS_NO_VARIADICS
453
613
_LIBCPP_END_NAMESPACE_STD
455
615
#endif // _LIBCPP_FUNCTIONAL_BASE