Skip to content

Commit 88632e4

Browse files
committed
[libc++] Refactor __less
This simplifies the usage of `__less` by making the class not depend on the types compared, but instead the `operator()`. We can't remove the template completely because we explicitly instantiate `std::__sort` with `__less<T>`. Reviewed By: ldionne, #libc Spies: arichardson, EricWF, libcxx-commits, mgrang Differential Revision: https://reviews.llvm.org/D145285
1 parent 0aa4af7 commit 88632e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+142
-128
lines changed

libcxx/include/__algorithm/binary_search.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
3737
bool
3838
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
3939
{
40-
return std::binary_search(__first, __last, __value,
41-
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
40+
return std::binary_search(__first, __last, __value, __less<>());
4241
}
4342

4443
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/clamp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ _LIBCPP_INLINE_VISIBILITY constexpr
3737
const _Tp&
3838
clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
3939
{
40-
return _VSTD::clamp(__v, __lo, __hi, __less<_Tp>());
40+
return _VSTD::clamp(__v, __lo, __hi, __less<>());
4141
}
4242
#endif
4343

libcxx/include/__algorithm/comp.h

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,17 @@ struct __equal_to {
2929
template <class _Lhs, class _Rhs>
3030
struct __is_trivial_equality_predicate<__equal_to, _Lhs, _Rhs> : true_type {};
3131

32-
template <class _T1, class _T2 = _T1>
33-
struct __less
34-
{
35-
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
36-
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
37-
38-
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
39-
bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;}
40-
41-
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
42-
bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;}
43-
44-
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
45-
bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;}
46-
};
47-
48-
template <class _T1>
49-
struct __less<_T1, _T1>
50-
{
51-
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
52-
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
53-
};
54-
55-
template <class _T1>
56-
struct __less<const _T1, _T1>
57-
{
58-
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
59-
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
60-
};
61-
62-
template <class _T1>
63-
struct __less<_T1, const _T1>
64-
{
65-
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
66-
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
32+
// The definition is required because __less is part of the ABI, but it's empty
33+
// because all comparisons should be transparent.
34+
template <class _T1 = void, class _T2 = _T1>
35+
struct __less {};
36+
37+
template <>
38+
struct __less<void, void> {
39+
template <class _Tp, class _Up>
40+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __lhs, const _Up& __rhs) const {
41+
return __lhs < __rhs;
42+
}
6743
};
6844

6945
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/equal_range.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
7575
template <class _ForwardIterator, class _Tp>
7676
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
7777
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
78-
return std::equal_range(
79-
std::move(__first),
80-
std::move(__last),
81-
__value,
82-
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
78+
return std::equal_range(std::move(__first), std::move(__last), __value, __less<>());
8379
}
8480

8581
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/includes.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
6161
template <class _InputIterator1, class _InputIterator2>
6262
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
6363
includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
64-
return std::includes(
65-
std::move(__first1),
66-
std::move(__last1),
67-
std::move(__first2),
68-
std::move(__last2),
69-
__less<typename iterator_traits<_InputIterator1>::value_type,
70-
typename iterator_traits<_InputIterator2>::value_type>());
64+
return std::includes(std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __less<>());
7165
}
7266

7367
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/inplace_merge.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ inline _LIBCPP_HIDE_FROM_ABI
246246
void
247247
inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last)
248248
{
249-
std::inplace_merge(std::move(__first), std::move(__middle), std::move(__last),
250-
__less<typename iterator_traits<_BidirectionalIterator>::value_type>());
249+
std::inplace_merge(std::move(__first), std::move(__middle), std::move(__last), __less<>());
251250
}
252251

253252
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/is_heap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
3636
bool
3737
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
3838
{
39-
return _VSTD::is_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
39+
return _VSTD::is_heap(__first, __last, __less<>());
4040
}
4141

4242
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/is_heap_until.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ template<class _RandomAccessIterator>
5858
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
5959
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
6060
{
61-
return _VSTD::__is_heap_until(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
61+
return _VSTD::__is_heap_until(__first, __last, __less<>());
6262
}
6363

6464
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/is_sorted.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
3636
bool
3737
is_sorted(_ForwardIterator __first, _ForwardIterator __last)
3838
{
39-
return _VSTD::is_sorted(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
39+
return _VSTD::is_sorted(__first, __last, __less<>());
4040
}
4141

4242
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/is_sorted_until.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ template<class _ForwardIterator>
4848
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
4949
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
5050
{
51-
return _VSTD::is_sorted_until(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
51+
return _VSTD::is_sorted_until(__first, __last, __less<>());
5252
}
5353

5454
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/lexicographical_compare.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ bool
5252
lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
5353
_InputIterator2 __first2, _InputIterator2 __last2)
5454
{
55-
return _VSTD::lexicographical_compare(__first1, __last1, __first2, __last2,
56-
__less<typename iterator_traits<_InputIterator1>::value_type,
57-
typename iterator_traits<_InputIterator2>::value_type>());
55+
return _VSTD::lexicographical_compare(__first1, __last1, __first2, __last2, __less<>());
5856
}
5957

6058
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/lower_bound.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last,
5858
template <class _ForwardIterator, class _Tp>
5959
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
6060
_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
61-
return std::lower_bound(__first, __last, __value,
62-
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
61+
return std::lower_bound(__first, __last, __value, __less<>());
6362
}
6463

6564
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/make_heap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
4747
template <class _RandomAccessIterator>
4848
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
4949
void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
50-
std::make_heap(std::move(__first), std::move(__last),
51-
__less<typename iterator_traits<_RandomAccessIterator>::value_type>());
50+
std::make_heap(std::move(__first), std::move(__last), __less<>());
5251
}
5352

5453
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/max.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
3939
const _Tp&
4040
max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
4141
{
42-
return _VSTD::max(__a, __b, __less<_Tp>());
42+
return _VSTD::max(__a, __b, __less<>());
4343
}
4444

4545
#ifndef _LIBCPP_CXX03_LANG
@@ -59,7 +59,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
5959
_Tp
6060
max(initializer_list<_Tp> __t)
6161
{
62-
return *_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>());
62+
return *_VSTD::max_element(__t.begin(), __t.end(), __less<>());
6363
}
6464

6565
#endif // _LIBCPP_CXX03_LANG

libcxx/include/__algorithm/max_element.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ template <class _ForwardIterator>
4848
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
4949
max_element(_ForwardIterator __first, _ForwardIterator __last)
5050
{
51-
return _VSTD::max_element(__first, __last,
52-
__less<typename iterator_traits<_ForwardIterator>::value_type>());
51+
return _VSTD::max_element(__first, __last, __less<>());
5352
}
5453

5554
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/merge.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ _OutputIterator
6060
merge(_InputIterator1 __first1, _InputIterator1 __last1,
6161
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
6262
{
63-
typedef typename iterator_traits<_InputIterator1>::value_type __v1;
64-
typedef typename iterator_traits<_InputIterator2>::value_type __v2;
65-
return _VSTD::merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>());
63+
return _VSTD::merge(__first1, __last1, __first2, __last2, __result, __less<>());
6664
}
6765

6866
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/min.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
3939
const _Tp&
4040
min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
4141
{
42-
return _VSTD::min(__a, __b, __less<_Tp>());
42+
return _VSTD::min(__a, __b, __less<>());
4343
}
4444

4545
#ifndef _LIBCPP_CXX03_LANG
@@ -59,7 +59,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
5959
_Tp
6060
min(initializer_list<_Tp> __t)
6161
{
62-
return *_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>());
62+
return *_VSTD::min_element(__t.begin(), __t.end(), __less<>());
6363
}
6464

6565
#endif // _LIBCPP_CXX03_LANG

libcxx/include/__algorithm/min_element.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ template <class _ForwardIterator>
6161
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
6262
min_element(_ForwardIterator __first, _ForwardIterator __last)
6363
{
64-
return _VSTD::min_element(__first, __last,
65-
__less<typename iterator_traits<_ForwardIterator>::value_type>());
64+
return _VSTD::min_element(__first, __last, __less<>());
6665
}
6766

6867
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/minmax.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
3939
pair<const _Tp&, const _Tp&>
4040
minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
4141
{
42-
return std::minmax(__a, __b, __less<_Tp>());
42+
return std::minmax(__a, __b, __less<>());
4343
}
4444

4545
#ifndef _LIBCPP_CXX03_LANG
@@ -59,7 +59,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
5959
pair<_Tp, _Tp>
6060
minmax(initializer_list<_Tp> __t)
6161
{
62-
return std::minmax(__t, __less<_Tp>());
62+
return std::minmax(__t, __less<>());
6363
}
6464

6565
#endif // _LIBCPP_CXX03_LANG

libcxx/include/__algorithm/minmax_element.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
9494
template <class _ForwardIterator>
9595
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
9696
pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) {
97-
return std::minmax_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
97+
return std::minmax_element(__first, __last, __less<>());
9898
}
9999

100100
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/next_permutation.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
6969
bool
7070
next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
7171
{
72-
return _VSTD::next_permutation(__first, __last,
73-
__less<typename iterator_traits<_BidirectionalIterator>::value_type>());
72+
return _VSTD::next_permutation(__first, __last, __less<>());
7473
}
7574

7675
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/nth_element.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Ra
249249
template <class _RandomAccessIterator>
250250
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
251251
void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) {
252-
std::nth_element(std::move(__first), std::move(__nth), std::move(__last), __less<typename
253-
iterator_traits<_RandomAccessIterator>::value_type>());
252+
std::nth_element(std::move(__first), std::move(__nth), std::move(__last), __less<>());
254253
}
255254

256255
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/partial_sort.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
8888
void
8989
partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
9090
{
91-
_VSTD::partial_sort(__first, __middle, __last,
92-
__less<typename iterator_traits<_RandomAccessIterator>::value_type>());
91+
_VSTD::partial_sort(__first, __middle, __last, __less<>());
9392
}
9493

9594
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/partial_sort_copy.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ _RandomAccessIterator
7979
partial_sort_copy(_InputIterator __first, _InputIterator __last,
8080
_RandomAccessIterator __result_first, _RandomAccessIterator __result_last)
8181
{
82-
return _VSTD::partial_sort_copy(__first, __last, __result_first, __result_last,
83-
__less<typename iterator_traits<_RandomAccessIterator>::value_type>());
82+
return _VSTD::partial_sort_copy(__first, __last, __result_first, __result_last, __less<>());
8483
}
8584

8685
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/pop_heap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
6565
template <class _RandomAccessIterator>
6666
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
6767
void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
68-
std::pop_heap(std::move(__first), std::move(__last),
69-
__less<typename iterator_traits<_RandomAccessIterator>::value_type>());
68+
std::pop_heap(std::move(__first), std::move(__last), __less<>());
7069
}
7170

7271
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/prev_permutation.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
7070
bool
7171
prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
7272
{
73-
return _VSTD::prev_permutation(__first, __last,
74-
__less<typename iterator_traits<_BidirectionalIterator>::value_type>());
73+
return _VSTD::prev_permutation(__first, __last, __less<>());
7574
}
7675

7776
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/push_heap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
6969
template <class _RandomAccessIterator>
7070
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
7171
void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
72-
std::push_heap(std::move(__first), std::move(__last),
73-
__less<typename iterator_traits<_RandomAccessIterator>::value_type>());
72+
std::push_heap(std::move(__first), std::move(__last), __less<>());
7473
}
7574

7675
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/set_difference.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d
6666
_InputIterator2 __first2,
6767
_InputIterator2 __last2,
6868
_OutputIterator __result) {
69-
return std::__set_difference<_ClassicAlgPolicy>(
70-
__first1,
71-
__last1,
72-
__first2,
73-
__last2,
74-
__result,
75-
__less<typename iterator_traits<_InputIterator1>::value_type,
76-
typename iterator_traits<_InputIterator2>::value_type>()).second;
69+
return std::__set_difference<_ClassicAlgPolicy>(__first1, __last1, __first2, __last2, __result, __less<>()).second;
7770
}
7871

7972
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/set_intersection.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_i
8989
std::move(__first2),
9090
std::move(__last2),
9191
std::move(__result),
92-
__less<typename iterator_traits<_InputIterator1>::value_type,
93-
typename iterator_traits<_InputIterator2>::value_type>())
92+
__less<>())
9493
.__out_;
9594
}
9695

libcxx/include/__algorithm/set_symmetric_difference.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_symmetri
9696
std::move(__first2),
9797
std::move(__last2),
9898
std::move(__result),
99-
__less<typename iterator_traits<_InputIterator1>::value_type,
100-
typename iterator_traits<_InputIterator2>::value_type>());
99+
__less<>());
101100
}
102101

103102
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/set_union.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_union(
9292
std::move(__first2),
9393
std::move(__last2),
9494
std::move(__result),
95-
__less<typename iterator_traits<_InputIterator1>::value_type,
96-
typename iterator_traits<_InputIterator2>::value_type>());
95+
__less<>());
9796
}
9897

9998
_LIBCPP_END_NAMESPACE_STD

0 commit comments

Comments
 (0)