tmp/tmppnxps08b/{from.md → to.md}
RENAMED
|
@@ -14,59 +14,82 @@ Each library clause contains the following elements, as applicable:[^1]
|
|
| 14 |
The Summary provides a synopsis of the category, and introduces the
|
| 15 |
first-level subclauses. Each subclause also provides a summary, listing
|
| 16 |
the headers specified in the subclause and the library entities provided
|
| 17 |
in each header.
|
| 18 |
|
| 19 |
-
Paragraphs labeled “Note(s):” or “Example(s):” are informative, other
|
| 20 |
-
paragraphs are normative.
|
| 21 |
-
|
| 22 |
The contents of the summary and the detailed specifications include:
|
| 23 |
|
| 24 |
- macros
|
| 25 |
- values
|
| 26 |
-
- types
|
| 27 |
- classes and class templates
|
| 28 |
- functions and function templates
|
| 29 |
-
- objects
|
|
|
|
| 30 |
|
| 31 |
#### Requirements <a id="structure.requirements">[[structure.requirements]]</a>
|
| 32 |
|
| 33 |
-
Requirements describe constraints that shall be met by a C++
|
| 34 |
-
extends the standard library. Such extensions are generally one of
|
| 35 |
-
following:
|
| 36 |
|
| 37 |
- Template arguments
|
| 38 |
- Derived classes
|
| 39 |
- Containers, iterators, and algorithms that meet an interface
|
| 40 |
-
convention
|
| 41 |
|
| 42 |
The string and iostream components use an explicit representation of
|
| 43 |
operations required of template arguments. They use a class template
|
| 44 |
`char_traits` to define these constraints.
|
| 45 |
|
| 46 |
Interface convention requirements are stated as generally as possible.
|
| 47 |
-
Instead of stating “class X has to define a member function
|
| 48 |
`operator++()`”, the interface requires “for any object `x` of class
|
| 49 |
`X`, `++x` is defined”. That is, whether the operator is a member is
|
| 50 |
unspecified.
|
| 51 |
|
| 52 |
Requirements are stated in terms of well-defined expressions that define
|
| 53 |
-
valid terms of the types that
|
| 54 |
-
well-defined expression requirements there is a
|
| 55 |
-
initial set of the valid expressions and their
|
| 56 |
-
algorithm
|
| 57 |
-
requirements is described in terms of the valid
|
| 58 |
-
template type parameters.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
Template argument requirements are sometimes referenced by name. See
|
| 61 |
[[type.descriptions]].
|
| 62 |
|
| 63 |
In some cases the semantic requirements are presented as C++ code. Such
|
| 64 |
code is intended as a specification of equivalence of a construct to
|
| 65 |
another construct, not necessarily as the way the construct must be
|
| 66 |
implemented.[^2]
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
#### Detailed specifications <a id="structure.specifications">[[structure.specifications]]</a>
|
| 69 |
|
| 70 |
The detailed specifications each contain the following elements:
|
| 71 |
|
| 72 |
- name and brief description
|
|
@@ -86,58 +109,75 @@ appropriate):[^3]
|
|
| 86 |
- operators and other non-member functions
|
| 87 |
|
| 88 |
Descriptions of function semantics contain the following elements (as
|
| 89 |
appropriate):[^4]
|
| 90 |
|
| 91 |
-
- *
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
- *Throws:* any exceptions thrown by the function, and the conditions
|
| 98 |
-
that would cause the exception
|
| 99 |
-
- *Complexity:* the time and/or space complexity of the function
|
| 100 |
-
- *Remarks:* additional semantic constraints on the function
|
| 101 |
- *Error conditions:* the error conditions for error codes reported by
|
| 102 |
-
the function
|
| 103 |
|
| 104 |
-
Whenever the *Effects
|
| 105 |
function `F` are *Equivalent to* some code sequence, then the various
|
| 106 |
-
elements are interpreted as follows. If `F`’s semantics specifies
|
| 107 |
-
*
|
| 108 |
-
the *equivalent-to* semantics. Next, the
|
| 109 |
-
are determined by the *
|
| 110 |
-
*
|
| 111 |
-
,
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
|
|
|
| 117 |
occurrences of that element in the code sequence.
|
| 118 |
|
| 119 |
-
For non-reserved replacement and handler functions,
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
described is the required behavior.
|
| 127 |
|
| 128 |
If the formulation of a complexity requirement calls for a negative
|
| 129 |
number of operations, the actual requirement is zero operations.[^5]
|
| 130 |
|
| 131 |
Complexity requirements specified in the library clauses are upper
|
| 132 |
bounds, and implementations that provide better complexity guarantees
|
| 133 |
-
|
| 134 |
|
| 135 |
Error conditions specify conditions where a function may fail. The
|
| 136 |
conditions are listed, together with a suitable explanation, as the
|
| 137 |
-
`enum class errc` constants
|
| 138 |
|
| 139 |
#### C library <a id="structure.see.also">[[structure.see.also]]</a>
|
| 140 |
|
| 141 |
-
Paragraphs labeled “
|
| 142 |
-
|
|
|
|
| 143 |
|
|
|
|
| 14 |
The Summary provides a synopsis of the category, and introduces the
|
| 15 |
first-level subclauses. Each subclause also provides a summary, listing
|
| 16 |
the headers specified in the subclause and the library entities provided
|
| 17 |
in each header.
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
The contents of the summary and the detailed specifications include:
|
| 20 |
|
| 21 |
- macros
|
| 22 |
- values
|
| 23 |
+
- types and alias templates
|
| 24 |
- classes and class templates
|
| 25 |
- functions and function templates
|
| 26 |
+
- objects and variable templates
|
| 27 |
+
- concepts
|
| 28 |
|
| 29 |
#### Requirements <a id="structure.requirements">[[structure.requirements]]</a>
|
| 30 |
|
| 31 |
+
Requirements describe constraints that shall be met by a C++ program
|
| 32 |
+
that extends the standard library. Such extensions are generally one of
|
| 33 |
+
the following:
|
| 34 |
|
| 35 |
- Template arguments
|
| 36 |
- Derived classes
|
| 37 |
- Containers, iterators, and algorithms that meet an interface
|
| 38 |
+
convention or model a concept
|
| 39 |
|
| 40 |
The string and iostream components use an explicit representation of
|
| 41 |
operations required of template arguments. They use a class template
|
| 42 |
`char_traits` to define these constraints.
|
| 43 |
|
| 44 |
Interface convention requirements are stated as generally as possible.
|
| 45 |
+
Instead of stating “class `X` has to define a member function
|
| 46 |
`operator++()`”, the interface requires “for any object `x` of class
|
| 47 |
`X`, `++x` is defined”. That is, whether the operator is a member is
|
| 48 |
unspecified.
|
| 49 |
|
| 50 |
Requirements are stated in terms of well-defined expressions that define
|
| 51 |
+
valid terms of the types that meet the requirements. For every set of
|
| 52 |
+
well-defined expression requirements there is either a named concept or
|
| 53 |
+
a table that specifies an initial set of the valid expressions and their
|
| 54 |
+
semantics. Any generic algorithm [[algorithms]] that uses the
|
| 55 |
+
well-defined expression requirements is described in terms of the valid
|
| 56 |
+
expressions for its template type parameters.
|
| 57 |
+
|
| 58 |
+
The library specification uses a typographical convention for naming
|
| 59 |
+
requirements. Names in *italic* type that begin with the prefix *Cpp17*
|
| 60 |
+
refer to sets of well-defined expression requirements typically
|
| 61 |
+
presented in tabular form, possibly with additional prose semantic
|
| 62 |
+
requirements. For example, *Cpp17Destructible* ([[cpp17.destructible]])
|
| 63 |
+
is such a named requirement. Names in `constant width` type refer to
|
| 64 |
+
library concepts which are presented as a concept definition [[temp]],
|
| 65 |
+
possibly with additional prose semantic requirements. For example,
|
| 66 |
+
`destructible` [[concept.destructible]] is such a named requirement.
|
| 67 |
|
| 68 |
Template argument requirements are sometimes referenced by name. See
|
| 69 |
[[type.descriptions]].
|
| 70 |
|
| 71 |
In some cases the semantic requirements are presented as C++ code. Such
|
| 72 |
code is intended as a specification of equivalence of a construct to
|
| 73 |
another construct, not necessarily as the way the construct must be
|
| 74 |
implemented.[^2]
|
| 75 |
|
| 76 |
+
Required operations of any concept defined in this document need not be
|
| 77 |
+
total functions; that is, some arguments to a required operation may
|
| 78 |
+
result in the required semantics failing to be met.
|
| 79 |
+
|
| 80 |
+
[*Example 1*: The required `<` operator of the `totally_ordered`
|
| 81 |
+
concept [[concept.totallyordered]] does not meet the semantic
|
| 82 |
+
requirements of that concept when operating on NaNs. — *end example*]
|
| 83 |
+
|
| 84 |
+
This does not affect whether a type models the concept.
|
| 85 |
+
|
| 86 |
+
A declaration may explicitly impose requirements through its associated
|
| 87 |
+
constraints [[temp.constr.decl]]. When the associated constraints refer
|
| 88 |
+
to a concept [[temp.concept]], the semantic constraints specified for
|
| 89 |
+
that concept are additionally imposed on the use of the declaration.
|
| 90 |
+
|
| 91 |
#### Detailed specifications <a id="structure.specifications">[[structure.specifications]]</a>
|
| 92 |
|
| 93 |
The detailed specifications each contain the following elements:
|
| 94 |
|
| 95 |
- name and brief description
|
|
|
|
| 109 |
- operators and other non-member functions
|
| 110 |
|
| 111 |
Descriptions of function semantics contain the following elements (as
|
| 112 |
appropriate):[^4]
|
| 113 |
|
| 114 |
+
- *Constraints:* the conditions for the function’s participation in
|
| 115 |
+
overload resolution [[over.match]]. \[*Note 1*: Failure to meet such a
|
| 116 |
+
condition results in the function’s silent
|
| 117 |
+
non-viability. — *end note*] \[*Example 1*: An implementation might
|
| 118 |
+
express such a condition via a *constraint-expression*
|
| 119 |
+
[[temp.constr.decl]]. — *end example*]
|
| 120 |
+
- *Mandates:* the conditions that, if not met, render the program
|
| 121 |
+
ill-formed. \[*Example 2*: An implementation might express such a
|
| 122 |
+
condition via the *constant-expression* in a
|
| 123 |
+
*static_assert-declaration* [[dcl.pre]]. If the diagnostic is to be
|
| 124 |
+
emitted only after the function has been selected by overload
|
| 125 |
+
resolution, an implementation might express such a condition via a
|
| 126 |
+
*constraint-expression* [[temp.constr.decl]] and also define the
|
| 127 |
+
function as deleted. — *end example*]
|
| 128 |
+
- *Preconditions:* the conditions that the function assumes to hold
|
| 129 |
+
whenever it is called.
|
| 130 |
+
- *Effects:* the actions performed by the function.
|
| 131 |
+
- *Synchronization:* the synchronization operations
|
| 132 |
+
[[intro.multithread]] applicable to the function.
|
| 133 |
+
- *Ensures:* the conditions (sometimes termed observable results)
|
| 134 |
+
established by the function.
|
| 135 |
+
- *Returns:* a description of the value(s) returned by the function.
|
| 136 |
- *Throws:* any exceptions thrown by the function, and the conditions
|
| 137 |
+
that would cause the exception.
|
| 138 |
+
- *Complexity:* the time and/or space complexity of the function.
|
| 139 |
+
- *Remarks:* additional semantic constraints on the function.
|
| 140 |
- *Error conditions:* the error conditions for error codes reported by
|
| 141 |
+
the function.
|
| 142 |
|
| 143 |
+
Whenever the *Effects* element specifies that the semantics of some
|
| 144 |
function `F` are *Equivalent to* some code sequence, then the various
|
| 145 |
+
elements are interpreted as follows. If `F`’s semantics specifies any
|
| 146 |
+
*Constraints* or *Mandates* elements, then those requirements are
|
| 147 |
+
logically imposed prior to the *equivalent-to* semantics. Next, the
|
| 148 |
+
semantics of the code sequence are determined by the *Constraints*,
|
| 149 |
+
*Mandates*, *Preconditions*, *Effects*, *Synchronization*,
|
| 150 |
+
*Postconditions*, *Returns*, *Throws*, *Complexity*, *Remarks*, and
|
| 151 |
+
*Error conditions* specified for the function invocations contained in
|
| 152 |
+
the code sequence. The value returned from `F` is specified by `F`’s
|
| 153 |
+
*Returns* element, or if `F` has no *Returns* element, a non-`void`
|
| 154 |
+
return from `F` is specified by the `return` statements [[stmt.return]]
|
| 155 |
+
in the code sequence. If `F`’s semantics contains a *Throws*,
|
| 156 |
+
*Postconditions*, or *Complexity* element, then that supersedes any
|
| 157 |
occurrences of that element in the code sequence.
|
| 158 |
|
| 159 |
+
For non-reserved replacement and handler functions, [[support]]
|
| 160 |
+
specifies two behaviors for the functions in question: their required
|
| 161 |
+
and default behavior. The *default behavior* describes a function
|
| 162 |
+
definition provided by the implementation. The *required behavior*
|
| 163 |
+
describes the semantics of a function definition provided by either the
|
| 164 |
+
implementation or a C++ program. Where no distinction is explicitly made
|
| 165 |
+
in the description, the behavior described is the required behavior.
|
|
|
|
| 166 |
|
| 167 |
If the formulation of a complexity requirement calls for a negative
|
| 168 |
number of operations, the actual requirement is zero operations.[^5]
|
| 169 |
|
| 170 |
Complexity requirements specified in the library clauses are upper
|
| 171 |
bounds, and implementations that provide better complexity guarantees
|
| 172 |
+
meet the requirements.
|
| 173 |
|
| 174 |
Error conditions specify conditions where a function may fail. The
|
| 175 |
conditions are listed, together with a suitable explanation, as the
|
| 176 |
+
`enum class errc` constants [[syserr]].
|
| 177 |
|
| 178 |
#### C library <a id="structure.see.also">[[structure.see.also]]</a>
|
| 179 |
|
| 180 |
+
Paragraphs labeled “<span class="smallcaps">See also</span>” contain
|
| 181 |
+
cross-references to the relevant portions of other standards
|
| 182 |
+
[[intro.refs]].
|
| 183 |
|