@@ -62,7 +62,7 @@ enum { __block_size = sizeof(uint64_t) * 8 };
62
62
63
63
// Ensures that __c(*__x, *__y) is true by swapping *__x and *__y if necessary.
64
64
template <class _Compare , class _RandomAccessIterator >
65
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
65
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
66
66
__cond_swap (_RandomAccessIterator __x, _RandomAccessIterator __y, _Compare __c) {
67
67
// Note: this function behaves correctly even with proxy iterators (because it relies on `value_type`).
68
68
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
@@ -76,7 +76,7 @@ __cond_swap(_RandomAccessIterator __x, _RandomAccessIterator __y, _Compare __c)
76
76
// Ensures that *__x, *__y and *__z are ordered according to the comparator __c,
77
77
// under the assumption that *__y and *__z are already ordered.
78
78
template <class _Compare , class _RandomAccessIterator >
79
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
79
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
80
80
__partially_sorted_swap (_RandomAccessIterator __x, _RandomAccessIterator __y, _RandomAccessIterator __z, _Compare __c) {
81
81
// Note: this function behaves correctly even with proxy iterators (because it relies on `value_type`).
82
82
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
@@ -95,7 +95,7 @@ template <class,
95
95
class _Compare ,
96
96
class _RandomAccessIterator ,
97
97
__enable_if_t <__use_branchless_sort<_Compare, _RandomAccessIterator>, int > = 0 >
98
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
98
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
99
99
__sort3 (_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _Compare __c) {
100
100
bool __swapped1 = std::__cond_swap<_Compare>(__x2, __x3, __c);
101
101
bool __swapped2 = std::__partially_sorted_swap<_Compare>(__x1, __x2, __x3, __c);
@@ -106,7 +106,7 @@ template <class _AlgPolicy,
106
106
class _Compare ,
107
107
class _RandomAccessIterator ,
108
108
__enable_if_t <!__use_branchless_sort<_Compare, _RandomAccessIterator>, int > = 0 >
109
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
109
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
110
110
__sort3 (_RandomAccessIterator __x, _RandomAccessIterator __y, _RandomAccessIterator __z, _Compare __c) {
111
111
using _Ops = _IterOps<_AlgPolicy>;
112
112
@@ -138,7 +138,7 @@ template <class,
138
138
class _Compare ,
139
139
class _RandomAccessIterator ,
140
140
__enable_if_t <__use_branchless_sort<_Compare, _RandomAccessIterator>, int > = 0 >
141
- inline _LIBCPP_HIDE_FROM_ABI void
141
+ inline void
142
142
__sort4 (_RandomAccessIterator __x1,
143
143
_RandomAccessIterator __x2,
144
144
_RandomAccessIterator __x3,
@@ -155,7 +155,7 @@ template <class _AlgPolicy,
155
155
class _Compare ,
156
156
class _RandomAccessIterator ,
157
157
__enable_if_t <!__use_branchless_sort<_Compare, _RandomAccessIterator>, int > = 0 >
158
- inline _LIBCPP_HIDE_FROM_ABI void
158
+ inline void
159
159
__sort4 (_RandomAccessIterator __x1,
160
160
_RandomAccessIterator __x2,
161
161
_RandomAccessIterator __x3,
@@ -180,7 +180,7 @@ template <class _AlgPolicy,
180
180
class _Compare ,
181
181
class _RandomAccessIterator ,
182
182
__enable_if_t <__use_branchless_sort<_Compare, _RandomAccessIterator>, int > = 0 >
183
- inline _LIBCPP_HIDE_FROM_ABI void
183
+ inline void
184
184
__sort5 (_RandomAccessIterator __x1,
185
185
_RandomAccessIterator __x2,
186
186
_RandomAccessIterator __x3,
@@ -199,7 +199,7 @@ template <class _AlgPolicy,
199
199
class _Compare ,
200
200
class _RandomAccessIterator ,
201
201
__enable_if_t <!__use_branchless_sort<_Compare, _RandomAccessIterator>, int > = 0 >
202
- inline _LIBCPP_HIDE_FROM_ABI void
202
+ inline void
203
203
__sort5 (_RandomAccessIterator __x1,
204
204
_RandomAccessIterator __x2,
205
205
_RandomAccessIterator __x3,
@@ -225,7 +225,7 @@ __sort5(_RandomAccessIterator __x1,
225
225
226
226
// Assumes size > 0
227
227
template <class _AlgPolicy , class _Compare , class _BidirectionalIterator >
228
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
228
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 void
229
229
__selection_sort (_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
230
230
_BidirectionalIterator __lm1 = __last;
231
231
for (--__lm1; __first != __lm1; ++__first) {
@@ -238,7 +238,7 @@ __selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last,
238
238
// Sort the iterator range [__first, __last) using the comparator __comp using
239
239
// the insertion sort algorithm.
240
240
template <class _AlgPolicy , class _Compare , class _BidirectionalIterator >
241
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
241
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 void
242
242
__insertion_sort (_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
243
243
using _Ops = _IterOps<_AlgPolicy>;
244
244
@@ -268,8 +268,7 @@ __insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last,
268
268
// Assumes that there is an element in the position (__first - 1) and that each
269
269
// element in the input range is greater or equal to the element at __first - 1.
270
270
template <class _AlgPolicy , class _Compare , class _RandomAccessIterator >
271
- _LIBCPP_HIDE_FROM_ABI void
272
- __insertion_sort_unguarded (_RandomAccessIterator const __first, _RandomAccessIterator __last, _Compare __comp) {
271
+ void __insertion_sort_unguarded (_RandomAccessIterator const __first, _RandomAccessIterator __last, _Compare __comp) {
273
272
using _Ops = _IterOps<_AlgPolicy>;
274
273
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
275
274
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
@@ -296,8 +295,7 @@ __insertion_sort_unguarded(_RandomAccessIterator const __first, _RandomAccessIte
296
295
}
297
296
298
297
template <class _AlgPolicy , class _Comp , class _RandomAccessIterator >
299
- _LIBCPP_HIDE_FROM_ABI bool
300
- __insertion_sort_incomplete (_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
298
+ bool __insertion_sort_incomplete (_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
301
299
using _Ops = _IterOps<_AlgPolicy>;
302
300
303
301
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
@@ -350,7 +348,7 @@ __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator
350
348
}
351
349
352
350
template <class _AlgPolicy , class _RandomAccessIterator >
353
- inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos (
351
+ inline void __swap_bitmap_pos (
354
352
_RandomAccessIterator __first, _RandomAccessIterator __last, uint64_t & __left_bitset, uint64_t & __right_bitset) {
355
353
using _Ops = _IterOps<_AlgPolicy>;
356
354
typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type;
@@ -368,7 +366,7 @@ inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos(
368
366
template <class _Compare ,
369
367
class _RandomAccessIterator ,
370
368
class _ValueType = typename iterator_traits<_RandomAccessIterator>::value_type>
371
- inline _LIBCPP_HIDE_FROM_ABI void
369
+ inline void
372
370
__populate_left_bitset (_RandomAccessIterator __first, _Compare __comp, _ValueType& __pivot, uint64_t & __left_bitset) {
373
371
// Possible vectorization. With a proper "-march" flag, the following loop
374
372
// will be compiled into a set of SIMD instructions.
@@ -384,7 +382,7 @@ __populate_left_bitset(_RandomAccessIterator __first, _Compare __comp, _ValueTyp
384
382
template <class _Compare ,
385
383
class _RandomAccessIterator ,
386
384
class _ValueType = typename iterator_traits<_RandomAccessIterator>::value_type>
387
- inline _LIBCPP_HIDE_FROM_ABI void
385
+ inline void
388
386
__populate_right_bitset (_RandomAccessIterator __lm1, _Compare __comp, _ValueType& __pivot, uint64_t & __right_bitset) {
389
387
// Possible vectorization. With a proper "-march" flag, the following loop
390
388
// will be compiled into a set of SIMD instructions.
@@ -401,7 +399,7 @@ template <class _AlgPolicy,
401
399
class _Compare ,
402
400
class _RandomAccessIterator ,
403
401
class _ValueType = typename iterator_traits<_RandomAccessIterator>::value_type>
404
- inline _LIBCPP_HIDE_FROM_ABI void __bitset_partition_partial_blocks (
402
+ inline void __bitset_partition_partial_blocks (
405
403
_RandomAccessIterator& __first,
406
404
_RandomAccessIterator& __lm1,
407
405
_Compare __comp,
@@ -448,7 +446,7 @@ inline _LIBCPP_HIDE_FROM_ABI void __bitset_partition_partial_blocks(
448
446
}
449
447
450
448
template <class _AlgPolicy , class _RandomAccessIterator >
451
- inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos_within (
449
+ inline void __swap_bitmap_pos_within (
452
450
_RandomAccessIterator& __first, _RandomAccessIterator& __lm1, uint64_t & __left_bitset, uint64_t & __right_bitset) {
453
451
using _Ops = _IterOps<_AlgPolicy>;
454
452
typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type;
@@ -489,7 +487,7 @@ inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos_within(
489
487
// __bitset_partition uses bitsets for storing outcomes of the comparisons
490
488
// between the pivot and other elements.
491
489
template <class _AlgPolicy , class _RandomAccessIterator , class _Compare >
492
- _LIBCPP_HIDE_FROM_ABI std::pair<_RandomAccessIterator, bool >
490
+ std::pair<_RandomAccessIterator, bool >
493
491
__bitset_partition (_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
494
492
using _Ops = _IterOps<_AlgPolicy>;
495
493
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type;
@@ -581,7 +579,7 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
581
579
// the provided range is already sorted, false otherwise. We assume that the
582
580
// length of the range is at least three elements.
583
581
template <class _AlgPolicy , class _RandomAccessIterator , class _Compare >
584
- _LIBCPP_HIDE_FROM_ABI std::pair<_RandomAccessIterator, bool >
582
+ std::pair<_RandomAccessIterator, bool >
585
583
__partition_with_equals_on_right (_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
586
584
using _Ops = _IterOps<_AlgPolicy>;
587
585
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
@@ -649,7 +647,7 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
649
647
// Similar to the above function. Elements equivalent to the pivot are put to
650
648
// the left of the pivot. Returns the iterator to the pivot element.
651
649
template <class _AlgPolicy , class _RandomAccessIterator , class _Compare >
652
- _LIBCPP_HIDE_FROM_ABI _RandomAccessIterator
650
+ _RandomAccessIterator
653
651
__partition_with_equals_on_left (_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
654
652
using _Ops = _IterOps<_AlgPolicy>;
655
653
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
@@ -827,7 +825,7 @@ void __introsort(_RandomAccessIterator __first,
827
825
}
828
826
829
827
template <typename _Number>
830
- inline _LIBCPP_HIDE_FROM_ABI _Number __log2i (_Number __n) {
828
+ inline _Number __log2i (_Number __n) {
831
829
if (__n == 0 )
832
830
return 0 ;
833
831
if (sizeof (__n) <= sizeof (unsigned ))
@@ -845,6 +843,7 @@ inline _LIBCPP_HIDE_FROM_ABI _Number __log2i(_Number __n) {
845
843
return __log2;
846
844
}
847
845
846
+ _LIBCPP_BEGIN_ABI_SENSITIVE
848
847
template <class _Comp , class _RandomAccessIterator >
849
848
void __sort (_RandomAccessIterator, _RandomAccessIterator, _Comp);
850
849
@@ -873,9 +872,10 @@ extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<float>&, float*>(fl
873
872
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<double >&, double *>(double *, double *, __less<double >&);
874
873
extern template _LIBCPP_EXPORTED_FROM_ABI void
875
874
__sort<__less<long double >&, long double *>(long double *, long double *, __less<long double >&);
875
+ _LIBCPP_END_ABI_SENSITIVE
876
876
877
877
template <class _AlgPolicy , class _RandomAccessIterator , class _Comp >
878
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
878
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 void
879
879
__sort_dispatch (_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
880
880
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
881
881
difference_type __depth_limit = 2 * std::__log2i (__last - __first);
@@ -912,35 +912,35 @@ using __sort_is_specialized_in_library _LIBCPP_NODEBUG = __is_any_of<
912
912
long double >;
913
913
914
914
template <class _AlgPolicy , class _Type , __enable_if_t <__sort_is_specialized_in_library<_Type>::value, int > = 0 >
915
- _LIBCPP_HIDE_FROM_ABI void __sort_dispatch (_Type* __first, _Type* __last, __less<>&) {
915
+ void __sort_dispatch (_Type* __first, _Type* __last, __less<>&) {
916
916
__less<_Type> __comp;
917
917
std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp);
918
918
}
919
919
920
920
template <class _AlgPolicy , class _Type , __enable_if_t <__sort_is_specialized_in_library<_Type>::value, int > = 0 >
921
- _LIBCPP_HIDE_FROM_ABI void __sort_dispatch (_Type* __first, _Type* __last, less<_Type>&) {
921
+ void __sort_dispatch (_Type* __first, _Type* __last, less<_Type>&) {
922
922
__less<_Type> __comp;
923
923
std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp);
924
924
}
925
925
926
926
#if _LIBCPP_STD_VER >= 14
927
927
template <class _AlgPolicy , class _Type , __enable_if_t <__sort_is_specialized_in_library<_Type>::value, int > = 0 >
928
- _LIBCPP_HIDE_FROM_ABI void __sort_dispatch (_Type* __first, _Type* __last, less<>&) {
928
+ void __sort_dispatch (_Type* __first, _Type* __last, less<>&) {
929
929
__less<_Type> __comp;
930
930
std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp);
931
931
}
932
932
#endif
933
933
934
934
#if _LIBCPP_STD_VER >= 20
935
935
template <class _AlgPolicy , class _Type , __enable_if_t <__sort_is_specialized_in_library<_Type>::value, int > = 0 >
936
- _LIBCPP_HIDE_FROM_ABI void __sort_dispatch (_Type* __first, _Type* __last, ranges::less&) {
936
+ void __sort_dispatch (_Type* __first, _Type* __last, ranges::less&) {
937
937
__less<_Type> __comp;
938
938
std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp);
939
939
}
940
940
#endif
941
941
942
942
template <class _AlgPolicy , class _RandomAccessIterator , class _Comp >
943
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
943
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void
944
944
__sort_impl (_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
945
945
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
946
946
@@ -954,14 +954,13 @@ __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp&
954
954
}
955
955
956
956
template <class _RandomAccessIterator , class _Comp >
957
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
957
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void
958
958
sort (_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
959
959
std::__sort_impl<_ClassicAlgPolicy>(std::move (__first), std::move (__last), __comp);
960
960
}
961
961
962
962
template <class _RandomAccessIterator >
963
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
964
- sort (_RandomAccessIterator __first, _RandomAccessIterator __last) {
963
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void sort (_RandomAccessIterator __first, _RandomAccessIterator __last) {
965
964
std::sort (__first, __last, __less<>());
966
965
}
967
966
0 commit comments