Skip to content

Commit 48b0a3b

Browse files
authored
Merge 2023-06 LWG Motion 5
P2562R1 constexpr Stable Sorting
2 parents b1fdcd5 + 086a6f3 commit 48b0a3b

File tree

2 files changed

+35
-34
lines changed

2 files changed

+35
-34
lines changed

source/algorithms.tex

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,9 +2011,9 @@
20112011
}
20122012

20132013
template<class RandomAccessIterator>
2014-
void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
2014+
constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
20152015
template<class RandomAccessIterator, class Compare>
2016-
void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
2016+
constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
20172017
Compare comp);
20182018
template<class ExecutionPolicy, class RandomAccessIterator>
20192019
void stable_sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
@@ -2027,10 +2027,10 @@
20272027
template<@\libconcept{random_access_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Comp = ranges::less,
20282028
class Proj = identity>
20292029
requires @\libconcept{sortable}@<I, Comp, Proj>
2030-
I stable_sort(I first, S last, Comp comp = {}, Proj proj = {});
2030+
constexpr I stable_sort(I first, S last, Comp comp = {}, Proj proj = {});
20312031
template<@\libconcept{random_access_range}@ R, class Comp = ranges::less, class Proj = identity>
20322032
requires @\libconcept{sortable}@<iterator_t<R>, Comp, Proj>
2033-
borrowed_iterator_t<R>
2033+
constexpr borrowed_iterator_t<R>
20342034
stable_sort(R&& r, Comp comp = {}, Proj proj = {});
20352035
}
20362036

@@ -2311,9 +2311,9 @@
23112311
}
23122312

23132313
template<class BidirectionalIterator, class Predicate>
2314-
BidirectionalIterator stable_partition(BidirectionalIterator first,
2315-
BidirectionalIterator last,
2316-
Predicate pred);
2314+
constexpr BidirectionalIterator stable_partition(BidirectionalIterator first,
2315+
BidirectionalIterator last,
2316+
Predicate pred);
23172317
template<class ExecutionPolicy, class BidirectionalIterator, class Predicate>
23182318
BidirectionalIterator stable_partition(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
23192319
BidirectionalIterator first,
@@ -2324,11 +2324,11 @@
23242324
template<@\libconcept{bidirectional_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
23252325
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
23262326
requires @\libconcept{permutable}@<I>
2327-
subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {});
2327+
constexpr subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {});
23282328
template<@\libconcept{bidirectional_range}@ R, class Proj = identity,
23292329
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
23302330
requires @\libconcept{permutable}@<iterator_t<R>>
2331-
borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {});
2331+
constexpr borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {});
23322332
}
23332333

23342334
template<class InputIterator, class OutputIterator1,
@@ -2427,13 +2427,13 @@
24272427
}
24282428

24292429
template<class BidirectionalIterator>
2430-
void inplace_merge(BidirectionalIterator first,
2431-
BidirectionalIterator middle,
2432-
BidirectionalIterator last);
2430+
constexpr void inplace_merge(BidirectionalIterator first,
2431+
BidirectionalIterator middle,
2432+
BidirectionalIterator last);
24332433
template<class BidirectionalIterator, class Compare>
2434-
void inplace_merge(BidirectionalIterator first,
2435-
BidirectionalIterator middle,
2436-
BidirectionalIterator last, Compare comp);
2434+
constexpr void inplace_merge(BidirectionalIterator first,
2435+
BidirectionalIterator middle,
2436+
BidirectionalIterator last, Compare comp);
24372437
template<class ExecutionPolicy, class BidirectionalIterator>
24382438
void inplace_merge(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
24392439
BidirectionalIterator first,
@@ -2449,10 +2449,10 @@
24492449
template<@\libconcept{bidirectional_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Comp = ranges::less,
24502450
class Proj = identity>
24512451
requires @\libconcept{sortable}@<I, Comp, Proj>
2452-
I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});
2452+
constexpr I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});
24532453
template<@\libconcept{bidirectional_range}@ R, class Comp = ranges::less, class Proj = identity>
24542454
requires @\libconcept{sortable}@<iterator_t<R>, Comp, Proj>
2455-
borrowed_iterator_t<R>
2455+
constexpr borrowed_iterator_t<R>
24562456
inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
24572457
Proj proj = {});
24582458
}
@@ -6714,14 +6714,14 @@
67146714
\indexlibraryglobal{stable_sort}%
67156715
\begin{itemdecl}
67166716
template<class RandomAccessIterator>
6717-
void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
6717+
constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
67186718
template<class ExecutionPolicy, class RandomAccessIterator>
67196719
void stable_sort(ExecutionPolicy&& exec,
67206720
RandomAccessIterator first, RandomAccessIterator last);
67216721

67226722
template<class RandomAccessIterator, class Compare>
6723-
void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
6724-
Compare comp);
6723+
constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
6724+
Compare comp);
67256725
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
67266726
void stable_sort(ExecutionPolicy&& exec,
67276727
RandomAccessIterator first, RandomAccessIterator last,
@@ -6730,10 +6730,10 @@
67306730
template<@\libconcept{random_access_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Comp = ranges::less,
67316731
class Proj = identity>
67326732
requires @\libconcept{sortable}@<I, Comp, Proj>
6733-
I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {});
6733+
constexpr I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {});
67346734
template<@\libconcept{random_access_range}@ R, class Comp = ranges::less, class Proj = identity>
67356735
requires @\libconcept{sortable}@<iterator_t<R>, Comp, Proj>
6736-
borrowed_iterator_t<R>
6736+
constexpr borrowed_iterator_t<R>
67376737
ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {});
67386738
\end{itemdecl}
67396739

@@ -7512,7 +7512,8 @@
75127512
\begin{itemdecl}
75137513
template<class BidirectionalIterator, class Predicate>
75147514
BidirectionalIterator
7515-
stable_partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred);
7515+
constexpr stable_partition(BidirectionalIterator first, BidirectionalIterator last,
7516+
Predicate pred);
75167517
template<class ExecutionPolicy, class BidirectionalIterator, class Predicate>
75177518
BidirectionalIterator
75187519
stable_partition(ExecutionPolicy&& exec,
@@ -7521,11 +7522,11 @@
75217522
template<@\libconcept{bidirectional_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
75227523
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
75237524
requires @\libconcept{permutable}@<I>
7524-
subrange<I> ranges::stable_partition(I first, S last, Pred pred, Proj proj = {});
7525+
constexpr subrange<I> ranges::stable_partition(I first, S last, Pred pred, Proj proj = {});
75257526
template<@\libconcept{bidirectional_range}@ R, class Proj = identity,
75267527
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
75277528
requires @\libconcept{permutable}@<iterator_t<R>>
7528-
borrowed_subrange_t<R> ranges::stable_partition(R&& r, Pred pred, Proj proj = {});
7529+
constexpr borrowed_subrange_t<R> ranges::stable_partition(R&& r, Pred pred, Proj proj = {});
75297530
\end{itemdecl}
75307531

75317532
\begin{itemdescr}
@@ -7792,19 +7793,19 @@
77927793
\indexlibraryglobal{inplace_merge}%
77937794
\begin{itemdecl}
77947795
template<class BidirectionalIterator>
7795-
void inplace_merge(BidirectionalIterator first,
7796-
BidirectionalIterator middle,
7797-
BidirectionalIterator last);
7796+
constexpr void inplace_merge(BidirectionalIterator first,
7797+
BidirectionalIterator middle,
7798+
BidirectionalIterator last);
77987799
template<class ExecutionPolicy, class BidirectionalIterator>
77997800
void inplace_merge(ExecutionPolicy&& exec,
78007801
BidirectionalIterator first,
78017802
BidirectionalIterator middle,
78027803
BidirectionalIterator last);
78037804

78047805
template<class BidirectionalIterator, class Compare>
7805-
void inplace_merge(BidirectionalIterator first,
7806-
BidirectionalIterator middle,
7807-
BidirectionalIterator last, Compare comp);
7806+
constexpr void inplace_merge(BidirectionalIterator first,
7807+
BidirectionalIterator middle,
7808+
BidirectionalIterator last, Compare comp);
78087809
template<class ExecutionPolicy, class BidirectionalIterator, class Compare>
78097810
void inplace_merge(ExecutionPolicy&& exec,
78107811
BidirectionalIterator first,
@@ -7814,7 +7815,7 @@
78147815
template<@\libconcept{bidirectional_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Comp = ranges::less,
78157816
class Proj = identity>
78167817
requires @\libconcept{sortable}@<I, Comp, Proj>
7817-
I ranges::inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});
7818+
constexpr I ranges::inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});
78187819
\end{itemdecl}
78197820

78207821
\begin{itemdescr}
@@ -7865,7 +7866,7 @@
78657866
\begin{itemdecl}
78667867
template<@\libconcept{bidirectional_range}@ R, class Comp = ranges::less, class Proj = identity>
78677868
requires @\libconcept{sortable}@<iterator_t<R>, Comp, Proj>
7868-
borrowed_iterator_t<R>
7869+
constexpr borrowed_iterator_t<R>
78697870
ranges::inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {});
78707871
\end{itemdecl}
78717872

source/support.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@
592592
#define @\defnlibxname{cpp_lib_common_reference_wrapper}@ 202302L // also in \libheader{functional}
593593
#define @\defnlibxname{cpp_lib_complex_udls}@ 201309L // also in \libheader{complex}
594594
#define @\defnlibxname{cpp_lib_concepts}@ 202207L // also in \libheader{concepts}, \libheader{compare}
595-
#define @\defnlibxname{cpp_lib_constexpr_algorithms}@ 201806L // also in \libheader{algorithm}, \libheader{utility}
595+
#define @\defnlibxname{cpp_lib_constexpr_algorithms}@ 202306L // also in \libheader{algorithm}, \libheader{utility}
596596
#define @\defnlibxname{cpp_lib_constexpr_bitset}@ 202207L // also in \libheader{bitset}
597597
#define @\defnlibxname{cpp_lib_constexpr_charconv}@ 202207L // also in \libheader{charconv}
598598
#define @\defnlibxname{cpp_lib_constexpr_cmath}@ 202202L // also in \libheader{cmath}, \libheader{cstdlib}

0 commit comments

Comments
 (0)