Skip to content

P2976R1 Freestanding Library: algorithm, numeric, and random #7706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
278 changes: 141 additions & 137 deletions source/algorithms.tex

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions source/exec.tex
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,9 @@
\begin{codeblock}
namespace std {
// \ref{execpol.type}, execution policy type trait
template<class T> struct is_execution_policy;
template<class T> constexpr bool @\libglobal{is_execution_policy_v}@ = is_execution_policy<T>::value;
template<class T> struct is_execution_policy; // freestanding
template<class T> constexpr bool @\libglobal{is_execution_policy_v}@ = // freestanding
is_execution_policy<T>::value;
}

namespace std::execution {
Expand Down
7 changes: 5 additions & 2 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1002,8 +1002,9 @@
\indextext{entity!freestanding item}%
\indextext{deduction guide!freestanding item}%
\indextext{\idxgram{typedef-name}!freestanding item}%
An entity, deduction guide, or \grammarterm{typedef-name} is
a freestanding item if it is:
An entity, deduction guide, or \grammarterm{typedef-name}
is a freestanding item if its introducing declaration is not followed by
a comment that includes \textit{hosted}, and is:
\begin{itemize}
\item introduced by a declaration that is a freestanding item,
\item a member of a freestanding item other than a namespace,
Expand Down Expand Up @@ -1601,10 +1602,12 @@
\ref{iterators} & Iterators library & \tcode{<iterator>} \\ \rowsep
\ref{ranges} & Ranges library & \tcode{<ranges>} \\ \rowsep
\ref{algorithms} & Algorithms library & \tcode{<algorithm>}, \tcode{<numeric>} \\ \rowsep
\ref{execpol} & Execution policies & \tcode{<execpol>} \\ \rowsep
\ref{string.view} & String view classes & \tcode{<string_view>} \\ \rowsep
\ref{string.classes} & String classes & \tcode{<string>} \\ \rowsep
\ref{c.strings} & Null-terminated sequence utilities & \tcode{<cstring>}, \tcode{<cwchar>} \\ \rowsep
\ref{charconv} & Primitive numeric conversions & \tcode{<charconv>} \\ \rowsep
\ref{rand} & Random number generation & \tcode{<random>} \\ \rowsep
\ref{c.math} & Mathematical functions for floating-point types & \tcode{<cmath>} \\ \rowsep
\ref{atomics} & Atomics & \tcode{<atomic>} \\ \rowsep
\end{libsumtab}
Expand Down
57 changes: 33 additions & 24 deletions source/memory.tex
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,17 @@
constexpr void uninitialized_default_construct(NoThrowForwardIterator first, // freestanding
NoThrowForwardIterator last);
template<class ExecutionPolicy, class NoThrowForwardIterator>
void uninitialized_default_construct(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator first,
void uninitialized_default_construct(ExecutionPolicy&& exec, // freestanding-deleted,
NoThrowForwardIterator first, // see \ref{algorithms.parallel.overloads}
Comment on lines +197 to +198

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment is aligned with the other // freestandings. Same for others in this file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine, do you have anything specific in mind?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objections to the status quo.

NoThrowForwardIterator last);
template<class NoThrowForwardIterator, class Size>
constexpr NoThrowForwardIterator
uninitialized_default_construct_n(NoThrowForwardIterator first, Size n); // freestanding
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
NoThrowForwardIterator
uninitialized_default_construct_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator first, Size n);
uninitialized_default_construct_n(ExecutionPolicy&& exec, // freestanding-deleted,
NoThrowForwardIterator first, // see \ref{algorithms.parallel.overloads}
Size n);

namespace ranges {
template<@\exposconcept{nothrow-forward-iterator}@ I, @\exposconcept{nothrow-sentinel-for}@<I> S>
Expand All @@ -223,16 +224,17 @@
constexpr void uninitialized_value_construct(NoThrowForwardIterator first, // freestanding
NoThrowForwardIterator last);
template<class ExecutionPolicy, class NoThrowForwardIterator>
void uninitialized_value_construct(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator first,
void uninitialized_value_construct(ExecutionPolicy&& exec, // freestanding-deleted,
NoThrowForwardIterator first, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator last);
template<class NoThrowForwardIterator, class Size>
constexpr NoThrowForwardIterator
uninitialized_value_construct_n(NoThrowForwardIterator first, Size n); // freestanding
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
NoThrowForwardIterator
uninitialized_value_construct_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator first, Size n);
uninitialized_value_construct_n(ExecutionPolicy&& exec, // freestanding-deleted,
NoThrowForwardIterator first, // see \ref{algorithms.parallel.overloads}
Size n);

namespace ranges {
template<@\exposconcept{nothrow-forward-iterator}@ I, @\exposconcept{nothrow-sentinel-for}@<I> S>
Expand All @@ -253,17 +255,19 @@
InputIterator last,
NoThrowForwardIterator result);
template<class ExecutionPolicy, class ForwardIterator, class NoThrowForwardIterator>
NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
ForwardIterator first, ForwardIterator last,
NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // freestanding-deleted,
ForwardIterator first, // see \ref{algorithms.parallel.overloads}
ForwardIterator last,
NoThrowForwardIterator result);
template<class InputIterator, class Size, class NoThrowForwardIterator>
constexpr NoThrowForwardIterator uninitialized_copy_n(InputIterator first, // freestanding
Size n,
NoThrowForwardIterator result);
template<class ExecutionPolicy, class ForwardIterator, class Size,
class NoThrowForwardIterator>
NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
ForwardIterator first, Size n,
NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // freestanding-deleted,
ForwardIterator first, // see \ref{algorithms.parallel.overloads}
Size n,
NoThrowForwardIterator result);

namespace ranges {
Expand Down Expand Up @@ -293,8 +297,9 @@
InputIterator last,
NoThrowForwardIterator result);
template<class ExecutionPolicy, class ForwardIterator, class NoThrowForwardIterator>
NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
ForwardIterator first, ForwardIterator last,
NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // freestanding-deleted,
ForwardIterator first, // see \ref{algorithms.parallel.overloads}
ForwardIterator last,
NoThrowForwardIterator result);
template<class InputIterator, class Size, class NoThrowForwardIterator>
constexpr pair<InputIterator, NoThrowForwardIterator>
Expand All @@ -303,8 +308,9 @@
template<class ExecutionPolicy, class ForwardIterator, class Size,
class NoThrowForwardIterator>
pair<ForwardIterator, NoThrowForwardIterator>
uninitialized_move_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
ForwardIterator first, Size n, NoThrowForwardIterator result);
uninitialized_move_n(ExecutionPolicy&& exec, // freestanding-deleted,
ForwardIterator first, Size n, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator result);

namespace ranges {
template<class I, class O>
Expand Down Expand Up @@ -333,16 +339,18 @@
constexpr void uninitialized_fill(NoThrowForwardIterator first, // freestanding
NoThrowForwardIterator last, const T& x);
template<class ExecutionPolicy, class NoThrowForwardIterator, class T>
void uninitialized_fill(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator first, NoThrowForwardIterator last,
void uninitialized_fill(ExecutionPolicy&& exec, // freestanding-deleted,
NoThrowForwardIterator first, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator last,
const T& x);
template<class NoThrowForwardIterator, class Size, class T>
constexpr NoThrowForwardIterator
uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x); // freestanding
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size, class T>
NoThrowForwardIterator
uninitialized_fill_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator first, Size n, const T& x);
uninitialized_fill_n(ExecutionPolicy&& exec, // freestanding-deleted,
NoThrowForwardIterator first, // see \ref{algorithms.parallel.overloads}
Size n, const T& x);

namespace ranges {
template<@\exposconcept{nothrow-forward-iterator}@ I, @\exposconcept{nothrow-sentinel-for}@<I> S, class T>
Expand Down Expand Up @@ -374,14 +382,15 @@
constexpr void destroy(NoThrowForwardIterator first, // freestanding
NoThrowForwardIterator last);
template<class ExecutionPolicy, class NoThrowForwardIterator>
void destroy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator first, NoThrowForwardIterator last);
void destroy(ExecutionPolicy&& exec, // freestanding-deleted,
NoThrowForwardIterator first, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator last);
template<class NoThrowForwardIterator, class Size>
constexpr NoThrowForwardIterator destroy_n(NoThrowForwardIterator first, // freestanding
Size n);
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads}
NoThrowForwardIterator first, Size n);
NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // freestanding-deleted,
NoThrowForwardIterator first, Size n); // see \ref{algorithms.parallel.overloads}

namespace ranges {
template<@\libconcept{destructible}@ T>
Expand Down
Loading