10
10
#define _LIBCPP___ALGORITHM_COMP_REF_TYPE_H
11
11
12
12
#include < __config>
13
- #include < type_traits>
13
+
14
+ #ifdef _LIBCPP_DEBUG
15
+ # include < __debug>
16
+ # include < __utility/declval.h>
17
+ #endif
14
18
15
19
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16
20
#pragma GCC system_header
17
21
#endif
18
22
19
- _LIBCPP_PUSH_MACROS
20
- #include < __undef_macros>
21
-
22
23
_LIBCPP_BEGIN_NAMESPACE_STD
23
24
24
25
#ifdef _LIBCPP_DEBUG
@@ -27,11 +28,11 @@ template <class _Compare>
27
28
struct __debug_less
28
29
{
29
30
_Compare &__comp_;
30
- _LIBCPP_CONSTEXPR_AFTER_CXX17
31
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
31
32
__debug_less (_Compare& __c) : __comp_(__c) {}
32
33
33
34
template <class _Tp , class _Up >
34
- _LIBCPP_CONSTEXPR_AFTER_CXX17
35
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
35
36
bool operator ()(const _Tp& __x, const _Up& __y)
36
37
{
37
38
bool __r = __comp_ (__x, __y);
@@ -41,7 +42,7 @@ struct __debug_less
41
42
}
42
43
43
44
template <class _Tp , class _Up >
44
- _LIBCPP_CONSTEXPR_AFTER_CXX17
45
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
45
46
bool operator ()(_Tp& __x, _Up& __y)
46
47
{
47
48
bool __r = __comp_ (__x, __y);
@@ -51,7 +52,7 @@ struct __debug_less
51
52
}
52
53
53
54
template <class _LHS , class _RHS >
54
- _LIBCPP_CONSTEXPR_AFTER_CXX17
55
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
55
56
inline _LIBCPP_INLINE_VISIBILITY
56
57
decltype ((void )declval<_Compare&>()(
57
58
declval<_LHS &>(), declval<_RHS &>()))
@@ -61,7 +62,7 @@ struct __debug_less
61
62
}
62
63
63
64
template <class _LHS , class _RHS >
64
- _LIBCPP_CONSTEXPR_AFTER_CXX17
65
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
65
66
inline _LIBCPP_INLINE_VISIBILITY
66
67
void __do_compare_assert (long , _LHS &, _RHS &) {}
67
68
};
@@ -73,15 +74,12 @@ struct __comp_ref_type {
73
74
// Pass the comparator by lvalue reference. Or in debug mode, using a
74
75
// debugging wrapper that stores a reference.
75
76
#ifndef _LIBCPP_DEBUG
76
- typedef typename add_lvalue_reference< _Comp>::type type;
77
+ typedef _Comp& type;
77
78
#else
78
79
typedef __debug_less<_Comp> type;
79
80
#endif
80
81
};
81
82
82
-
83
83
_LIBCPP_END_NAMESPACE_STD
84
84
85
- _LIBCPP_POP_MACROS
86
-
87
85
#endif // _LIBCPP___ALGORITHM_COMP_REF_TYPE_H
0 commit comments