Skip to content

Commit bb20277

Browse files
authored
Merge 2022-07 LWG Motion 9
P1642R11 Freestanding Library: Easy [utilities], [ranges], and [iterators]
2 parents bedf8cc + 5e0de8b commit bb20277

File tree

10 files changed

+756
-638
lines changed

10 files changed

+756
-638
lines changed

source/concepts.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169

170170
\indexheader{concepts}%
171171
\begin{codeblock}
172+
// all freestanding
172173
namespace std {
173174
// \ref{concepts.lang}, language-related concepts
174175
// \ref{concept.same}, concept \libconcept{same_as}

source/intro.tex

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -844,12 +844,16 @@
844844

845845
\pnum
846846
Two kinds of implementations are defined: a \defnadj{hosted}{implementation} and a
847-
\defnadj{freestanding}{implementation}. For a hosted implementation, this
848-
document defines the set of available libraries. A freestanding
847+
\defnadj{freestanding}{implementation}.
848+
A freestanding
849849
implementation is one in which execution may take place without the benefit of
850-
an operating system, and has an \impldef{required libraries for freestanding
851-
implementation} set of libraries that includes certain language-support
852-
libraries\iref{compliance}.
850+
an operating system.
851+
A hosted implementation
852+
supports all the facilities described in this document, while
853+
a freestanding implementation
854+
supports the entire \Cpp{} language
855+
described in \ref{lex} through \ref{cpp} and
856+
the subset of the library facilities described in \ref{compliance}.
853857

854858
\pnum
855859
A conforming implementation may have extensions (including

source/iterators.tex

Lines changed: 152 additions & 137 deletions
Large diffs are not rendered by default.

source/lib-intro.tex

Lines changed: 66 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,52 @@
908908
\pnum
909909
An implementation may use any technique that provides equivalent observable behavior.
910910

911+
\rSec3[freestanding.entity]{Freestanding entities}
912+
913+
\pnum
914+
\indextext{entity!freestanding|see{freestanding entity}}%
915+
A \defn{freestanding entity} is a declaration or macro definition
916+
that is present in a freestanding implementation and a hosted implementation.
917+
918+
\pnum
919+
Unless otherwise specified,
920+
the requirements on freestanding entities on a freestanding implementation
921+
are the same as the corresponding requirements in a hosted implementation.
922+
923+
\pnum
924+
In a header synopsis, entities followed with a comment
925+
that includes \textit{freestanding} are freestanding entities.
926+
\begin{example}
927+
\begin{codeblock}
928+
#define NULL @\seebelow@ // freestanding
929+
\end{codeblock}
930+
\end{example}
931+
932+
\pnum
933+
If a header synopsis begins with a comment
934+
that includes \textit{all freestanding},
935+
then all of the declarations and macro definitions in the header synopsis
936+
are freestanding entities.
937+
\begin{example}
938+
\begin{codeblock}
939+
// all freestanding
940+
namespace std {
941+
\end{codeblock}
942+
\end{example}
943+
944+
\pnum
945+
Deduction guides for freestanding entity class templates are freestanding entities.
946+
947+
\pnum
948+
Enclosing namespaces of freestanding entities are freestanding entities.
949+
950+
\pnum
951+
Friends of freestanding entities are freestanding entities.
952+
953+
\pnum
954+
Entities denoted by freestanding entity \grammarterm{typedef-name}{s} and
955+
freestanding entity alias templates are freestanding entities.
956+
911957
\rSec1[requirements]{Library-wide requirements}
912958

913959
\rSec2[requirements.general]{General}
@@ -1350,38 +1396,31 @@
13501396
\ref{concepts} & Concepts library & \tcode{<concepts>} \\ \rowsep
13511397
\ref{type.traits} & Type traits & \tcode{<type_traits>} \\ \rowsep
13521398
\ref{bit} & Bit manipulation & \tcode{<bit>} \\ \rowsep
1353-
\ref{atomics} & Atomics & \tcode{<atomic>} \\
1399+
\ref{atomics} & Atomics & \tcode{<atomic>} \\ \rowsep
1400+
\ref{utility} & Utility components & \tcode{<utility>} \\ \rowsep
1401+
\ref{tuple} & Tuples & \tcode{<tuple>} \\ \rowsep
1402+
\ref{memory} & Memory & \tcode{<memory>} \\ \rowsep
1403+
\ref{function.objects} & Function objects & \tcode{<functional>} \\ \rowsep
1404+
\ref{ratio} & Compile-time rational arithmetic & \tcode{<ratio>} \\ \rowsep
1405+
\ref{iterators} & Iterators library & \tcode{<iterator>} \\ \rowsep
1406+
\ref{ranges} & Ranges library & \tcode{<ranges>} \\
13541407
\end{libsumtab}
13551408

13561409
\pnum
1357-
The supplied version of the header \libheaderref{cstdlib}
1358-
shall declare at least the functions
1359-
\indexlibraryglobal{abort}%
1360-
\tcode{abort},
1361-
\indexlibraryglobal{atexit}%
1362-
\tcode{atexit},
1363-
\indexlibraryglobal{at_quick_exit}%
1364-
\tcode{at_quick_exit},
1365-
\indexlibraryglobal{exit}%
1366-
\tcode{exit},
1367-
and
1368-
\indexlibraryglobal{quick_exit}%
1369-
\tcode{quick_exit}\iref{support.start.term}.
1370-
\indextext{implementation!hosted}%
1371-
The supplied version of the header \libheaderrefx{atomic}{atomics.syn}
1372-
shall meet the same requirements as for a hosted implementation
1373-
except that support for
1374-
always lock-free integral atomic types\iref{atomics.lockfree}
1375-
is \impldef{support for always lock-free integral atomic types in
1376-
freestanding environments}, and
1377-
whether or not the type aliases \tcode{atomic_signed_lock_free} and
1378-
\tcode{atomic_unsigned_lock_free} are defined\iref{atomics.alias}
1379-
is \impldef{type aliases \tcode{atomic_signed_lock_free} and
1380-
\tcode{atomic_unsigned_lock_free} in freestanding environments}.
1381-
The other headers listed in this table
1382-
shall meet the same requirements as for a hosted implementation.
1410+
For each of the headers listed in \tref{headers.cpp.fs},
1411+
a freestanding implementation provides at least
1412+
the freestanding entities\iref{freestanding.entity} declared in the header.
13831413
\indextext{implementation!freestanding|)}%
13841414

1415+
\pnum
1416+
\begin{note}
1417+
Throwing a standard library provided exception
1418+
is not observably different from \tcode{terminate()}
1419+
if the implementation does not
1420+
unwind the stack during exception handling\iref{except.handle} and
1421+
the user's program contains no catch blocks.
1422+
\end{note}
1423+
13851424
\rSec2[using]{Using the library}
13861425

13871426
\rSec3[using.overview]{Overview}

0 commit comments

Comments
 (0)