Skip to content

P0898R3 Standard Library Concepts #2176

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 34 commits into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d60ec60
P0619R4 Review of deprecated facilities
AlisdairM Jun 12, 2018
3e80cd4
[complex.special] Reorder defaulted complex copy constructor to
zygoloid Jun 22, 2018
fd244b5
[diff.cpp03.language.support] Remove change described in p1, which is no
zygoloid Jun 22, 2018
043ee62
[diff.cpp17.except] Add a note that there is no longer a way to write
zygoloid Jun 22, 2018
9e80b6c
[diff.cpp17.except] Fix Rationale to be a rationale.
zygoloid Jun 22, 2018
fa04176
[diff.cpp17.library] Fix list of new headers compared to C++17.
zygoloid Jun 23, 2018
cf07497
[diff.cpp17.library] Fix description of how to adjust code for the
zygoloid Jun 23, 2018
577dee5
[diff.cpp17.depr] Add paragraph numbering and fix whitespace.
zygoloid Jun 23, 2018
16b35d6
[depr.c.headers] Undo P0619R4's removal of synopses for <ccomplex>,
zygoloid Jun 23, 2018
04eb7aa
Merge 2018-06 LWG Motion 27
zygoloid Jun 25, 2018
643152d
[P0898R3] Standard Library Concepts: rename "old" concepts
CaseyCarter Jun 13, 2018
2d4e82c
[P0898R3] Standard Library Concepts: full wording
CaseyCarter Jun 13, 2018
af4a3f2
[concepts.lib.general.equality] Replace "this specification" with "th…
CaseyCarter Jun 21, 2018
e800697
[concepts.lib.general.equality] Hyphenate equality-preserving
CaseyCarter Jun 21, 2018
19d2ed0
[concepts] Shorten stable names:
CaseyCarter Jun 20, 2018
e9c46dd
[concepts.lang] Retitle as "Language-related concepts"
CaseyCarter Jun 21, 2018
31682fb
[support.limits.general] Add feature test macro __cpp_lib_concepts fo…
CaseyCarter Jun 20, 2018
9ad9c13
[concepts] Rephrase ocurrences of "must"
CaseyCarter Jun 21, 2018
d8db67f
[definitions] redefine expression-equivalent per ISO directives
CaseyCarter Jun 20, 2018
d3c70aa
[customization.point.object][meta.trans.other] Replace "user-defined"…
CaseyCarter Jun 19, 2018
245a8e3
[concepts.swappable] Correct example
CaseyCarter Jun 21, 2018
d5e62d6
[concepts.general][library.general] concepts constrain template argum…
CaseyCarter Jun 18, 2018
0301e37
[concept.convertibleto] Add clarifying comment
CaseyCarter Jun 21, 2018
e0aa860
[structure.requirements] Rephrase para 8 for clarity
CaseyCarter Jun 19, 2018
a9113be
[meta.trans.other] make style of common_type and common_reference con…
CaseyCarter Jun 19, 2018
089a362
[meta.trans.other] Remove basic_common_reference requirement with no …
CaseyCarter Jun 20, 2018
939e8dc
[rand.req.urng] Rework URBG requirements for clarity and simplicitly
CaseyCarter Jun 20, 2018
a9981a4
[meta.trans.other] Simplify common_type
CaseyCarter Jun 21, 2018
ebe222d
[concepts] Replace "template <" with "template<"
CaseyCarter Jun 22, 2018
53b285d
[concepts.syn] Remove trailing ":" from reference comments in synopsis
CaseyCarter Jun 22, 2018
acb06e3
macros.tex: change the \oldconcept prefix to "Cpp17"
CaseyCarter Jun 23, 2018
7677798
[concepts] There need be no "there need be no subsumption relationship"
CaseyCarter Jun 23, 2018
6523119
[concepts.integral] Merge [concept.integral], [concept.signed.int] an…
CaseyCarter Jun 23, 2018
11877fc
[structure.requirements] new para that explains the typographical con…
CaseyCarter Jun 23, 2018
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
172 changes: 86 additions & 86 deletions source/algorithms.tex

Large diffs are not rendered by default.

221 changes: 157 additions & 64 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1085,13 +1085,9 @@
and
\tcode{<unordered_set>}.
In addition the following C compatibility headers are new:
\tcode{<ccomplex>},
\tcode{<cfenv>},
\tcode{<cinttypes>},
\tcode{<cstdalign>},
\tcode{<cstdbool>},
\tcode{<cstdint>},
\tcode{<ctgmath>},
and
\tcode{<cuchar>}.
Valid \CppIII{} code that \tcode{\#include}{s} headers with these names may be
Expand Down Expand Up @@ -1123,40 +1119,6 @@
\rSec2[diff.cpp03.language.support]{\ref{language.support}:
language support library}

\diffref{new.delete.single}
\change Linking \tcode{new} and \tcode{delete} operators.
\rationale The two throwing single-object signatures of \tcode{operator new} and
\tcode{operator delete} are now specified to form the base functionality for
the other operators. This clarifies that replacing just these two signatures
changes others, even if they are not explicitly changed.
\effect
Valid \CppIII{} code that replaces global \tcode{new} or \tcode{delete}
operators may execute differently in this International Standard. For
example, the following program should write \tcode{"custom deallocation"} twice,
once for the single-object delete and once for the array delete.

\begin{codeblock}
#include <cstdio>
#include <cstdlib>
#include <new>

void* operator new(std::size_t size) throw(std::bad_alloc) {
return std::malloc(size);
}

void operator delete(void* ptr) throw() {
std::puts("custom deallocation");
std::free(ptr);
}

int main() {
int* i = new int;
delete i; // single-object delete
int* a = new int[3];
delete [] a; // array delete
}
\end{codeblock}

\diffref{new.delete.single}
\change \tcode{operator new} may throw exceptions other than
\tcode{std::bad_alloc}.
Expand All @@ -1165,6 +1127,10 @@
Valid \CppIII{} code that assumes that global \tcode{operator new} only
throws \tcode{std::bad_alloc} may execute differently in this International
Standard.
Valid \CppIII{} code that replaces the global replaceable \tcode{operator new}
is ill-formed in this International Standard,
because the exception specification of \tcode{throw(std::bad_alloc)}
was removed.

\rSec2[diff.cpp03.diagnostics]{\ref{diagnostics}: diagnostics library}

Expand All @@ -1186,7 +1152,7 @@
have different runtime behavior.

\diffref{refwrap}, \ref{arithmetic.operations}, \ref{comparisons},
\ref{logical.operations}, \ref{bitwise.operations}, \ref{depr.negators}
\ref{logical.operations}, \ref{bitwise.operations}
\change Standard function object types no longer derived from
\tcode{std::unary_function} or \tcode{std::binary_function}.
\rationale Superseded by new feature; \tcode{unary_function} and
Expand Down Expand Up @@ -1800,6 +1766,7 @@

\rSec2[diff.cpp14.depr]{\ref{depr}: compatibility features}

\nodiffref
\change
The class templates
\tcode{auto_ptr},
Expand All @@ -1818,6 +1785,7 @@
\effect Valid \CppXIV{} code that uses these class templates
and function templates may fail to compile in this International Standard.

\nodiffref
\change
Remove old iostreams members [depr.ios.members].
\rationale Redundant feature for compatibility with pre-standard code
Expand Down Expand Up @@ -1987,20 +1955,72 @@
}
\end{codeblock}

\rSec2[diff.cpp17.except]{\ref{except}: exception handling}

\diffref{except.spec}
\change Remove \tcode{throw()} exception specification.
\rationale
Removal of obsolete feature that has been replaced by \tcode{noexcept}.
\effect
A valid \CppXVII{} function declaration, member function declaration, function
pointer declaration, or function reference declaration that uses \tcode{throw()}
for its exception specification will be rejected as ill-formed in this
International Standard. It should simply be replaced with \tcode{noexcept} for no
change of meaning since \CppXVII{}.
\begin{note}
There is no way to write a function declaration
that is non-throwing in this International Standard
and is also non-throwing in \CppIII{}
except by using the preprocessor to generate
a different token sequence in each case.
\end{note}

\rSec2[diff.cpp17.library]{\ref{library}: library introduction}

\diffref{headers}
\change New headers.
\rationale New functionality.
\effect
The following \Cpp{} headers are new:
\tcode{<bit>},
\tcode{<compare>},
\tcode{<concepts>},
\tcode{<contract>},
\tcode{<span>},
\tcode{<syncstream>}, and
\tcode{<version>}.
Valid \CppXVII{} code that \tcode{\#include}{s} headers with these names may be
invalid in this International Standard.

\diffref{headers}
\change Remove vacuous \Cpp{} header files.
\rationale
The empty headers implied a false requirement to achieve C compatibility with the \Cpp{} headers.
\effect
A valid \CppXVII{} program that \tcode{\#include}{s} any of the following headers may fail to compile:
\tcode{<ccomplex>},
\tcode{<ciso646>},
\tcode{<cstdalign>},
\tcode{<cstdbool>}, and
\tcode{<ctgmath>}.
To retain the same behavior:
\begin{itemize}
\item
a \tcode{\#include} of \tcode{<ccomplex>} can be replaced by
a \tcode{\#include} of \tcode{<complex>}\iref{complex.syn},
\item
a \tcode{\#include} of \tcode{<ctgmath>} can be replaced by
a \tcode{\#include} of \tcode{<cmath>}\iref{cmath.syn} and
a \tcode{\#include} of \tcode{<complex>},
and
\item
a \tcode{\#include} of
\tcode{<ciso646>},
\tcode{<cstdalign>}, or
\tcode{<cstdbool>}
can simply be removed.
\end{itemize}

\rSec2[diff.cpp17.containers]{\ref{containers}: containers library}

\diffrefs{forwardlist}{list}
Expand All @@ -2013,6 +2033,89 @@
Translation units compiled against this version of \Cpp{} may be incompatible with
translation units compiled against \CppXVII{}, either failing to link or having undefined behavior.

\rSec2[diff.cpp17.depr]{\ref{depr}: compatibility features}

\nodiffref
\change Remove \tcode{uncaught_exception}.
\rationale
The function did not have a clear specification when multiple exceptions were
active, and has been superseded by \tcode{uncaught_exceptions}.
\effect
A valid \CppXVII{} program that calls \tcode{std::uncaught_exception} may fail
to compile. It might be revised to use \tcode{std::uncaught_exceptions} instead,
for clear and portable semantics.

\nodiffref
\change Remove support for adaptable function API.
\rationale
The deprecated support relied on a limited convention that could not be
extended to support the general case or new language features. It has been
superseded by direct language support with \tcode{decltype}, and by the
\tcode{std::bind} and \tcode{std::not_fn} function templates.
\effect
A valid \CppXVII{} program that relies on the presence of \tcode{result_type},
\tcode{argument_type}, \tcode{first_argument_type}, or
\tcode{second_argument_type} in a standard library class may fail to compile. A
valid \CppXVII{} program that calls \tcode{not1} or \tcode{not2}, or uses the
class templates \tcode{unary_negate} or \tcode{binary_negate}, may fail to
compile.

\nodiffref
\change Remove redundant members from \tcode{std::allocator}.
\rationale
\tcode{std::allocator} was overspecified, encouraging direct usage in user containers
rather than relying on \tcode{std::allocator_traits}, leading to poor containers.
\effect
A valid \CppXVII{} program that directly makes use of the \tcode{pointer},
\tcode{const_pointer}, \tcode{reference}, \tcode{const_reference},
\tcode{rebind}, \tcode{address}, \tcode{construct}, \tcode{destroy}, or
\tcode{max_size} members of \tcode{std::allocator}, or that directly calls
\tcode{allocate} with an additional hint argument, may fail to compile.

\nodiffref
\change Remove \tcode{raw_memory_iterator}.
\rationale
The iterator encouraged use of algorithms that might throw exceptions, but did
not return the number of elements successfully constructed that might need to
be destroyed in order to avoid leaks.
\effect
A valid \CppXVII{} program that uses this iterator class may fail to compile.

\nodiffref
\change Remove temporary buffers API.
\rationale
The temporary buffer facility was intended to provide an efficient optimization
for small memory requests, but there is little evidence this was achieved in
practice, while requiring the user to provide their own exception-safe wrappers
to guard use of the facility in many cases.
\effect
A valid \CppXVII{} program that calls \tcode{get_temporary_buffer} or
\tcode{return_temporary_buffer} may fail to compile.

\nodiffref
\change Remove \tcode{shared_ptr::unique}.
\rationale
The result of a call to this member function is not reliable in the presence of
multiple threads and weak pointers. The member function \tcode{use_count} is
similarly unreliable, but has a clearer contract in such cases, and remains
available for well defined use in single-threaded cases.
\effect
A valid \CppXVII{} program that calls \tcode{unique} on a \tcode{shared_ptr}
object may fail to compile.

\diffref{depr.meta.types}
\change Remove deprecated type traits.
\rationale
The traits had unreliable or awkward interfaces. The \tcode{is_literal_type}
trait provided no way to detect which subset of constructors and member
functions of a type were declared \tcode{constexpr}. The \tcode{result_of}
trait had a surprising syntax that could not report the result of a regular
function type. It has been superseded by the \tcode{invoke_result} trait.
\effect
A valid \CppXVII{} program that relies on the \tcode{is_literal_type} or
\tcode{result_of} type traits, on the \tcode{is_literal_type_v} variable template,
or on the \tcode{result_of_t} alias template may fail to compile.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\rSec1[diff.library]{C standard library}
\indextext{library!C standard}%
Expand All @@ -2031,27 +2134,17 @@
in~\ref{depr.c.headers}, but their use is deprecated in \Cpp{}.

\pnum
There are no \Cpp{} headers for the C headers
There are no \Cpp{} headers for the C standard library's headers
\tcode{<stdatomic.h>}\indextext{\idxhdr{stdatomic.h}!absence thereof},
\tcode{<stdnoreturn.h>}\indextext{\idxhdr{stdnoreturn.h}!absence thereof},
and \tcode{<threads.h>}\indextext{\idxhdr{threads.h}!absence thereof},
nor are the C headers themselves part of \Cpp{}.
nor are these headers from the C standard library headers themselves part of \Cpp{}.

\pnum
The \Cpp{} headers \tcode{<ccomplex>}\indexhdr{ccomplex}\iref{depr.ccomplex.syn}
and \tcode{<ctgmath>}\indexhdr{ctgmath}\iref{depr.ctgmath.syn}, as well
as their corresponding C headers \tcode{<complex.h>}\indexhdr{complex.h}
and \tcode{<tgmath.h>}\indexhdr{tgmath.h}, do not contain any of the
content from the C standard library and instead merely include other headers
from the \Cpp{} standard library.

\pnum
The headers \tcode{<ciso646>}\indexhdr{ciso646},
\tcode{<cstdalign>}\indexhdr{cstdalign}\iref{depr.cstdalign.syn},
and \tcode{<cstdbool>}\indexhdr{cstdbool}\iref{depr.cstdbool.syn}
are meaningless in \Cpp{}. Use of
the \Cpp{} headers \tcode{<ccomplex>}, \tcode{<cstdalign>}, \tcode{<cstdbool>},
and \tcode{<ctgmath>} is deprecated\iref{depr.c.headers}.
The C headers \tcode{<complex.h>}\indexhdr{complex.h} and
\tcode{<tgmath.h>}\indexhdr{tgmath.h} do not contain any of the content from
the C standard library and instead merely include other headers from the \Cpp{}
standard library.

\rSec2[diff.mods.to.definitions]{Modifications to definitions}

Expand Down Expand Up @@ -2103,27 +2196,27 @@
and
\tcode{xor_eq}
are keywords in this International
Standard\iref{lex.key}.
They do not appear as macro names defined in
\tcode{<ciso646>}.
\indexhdr{ciso646}%
Standard\iref{lex.key},
and are not introduced as macros
by \tcode{<iso646.h>}\iref{depr.iso646.h.syn}.

\rSec3[diff.header.stdalign.h]{Header \tcode{<stdalign.h>}}
\indexhdr{stdalign.h}%

\pnum
The token \tcode{alignas} is a keyword in this International
Standard\iref{lex.key}. It does not appear as a macro name defined
in \tcode{<cstdalign>}\indexhdr{cstdalign}\iref{depr.cstdalign.syn}.
Standard\iref{lex.key},
and is not introduced as a macro
by \tcode{<stdalign.h>}\iref{depr.stdalign.h.syn}.

\rSec3[diff.header.stdbool.h]{Header \tcode{<stdbool.h>}}
\indexhdr{stdbool.h}%

\pnum
The tokens \tcode{bool}, \tcode{true}, and \tcode{false}
are keywords in this International Standard\iref{lex.key}.
They do not appear as macro names defined in
\tcode{<cstdbool>}\indexhdr{cstdbool}\iref{depr.cstdbool.syn}.
are keywords in this International Standard\iref{lex.key},
and are not introduced as macros
by \tcode{<stdbool.h>}\iref{depr.stdbool.h.syn}.

\rSec3[diff.null]{Macro \tcode{NULL}}

Expand Down
Loading