tmp/tmpicpmr0to/{from.md → to.md}
RENAMED
|
@@ -8,37 +8,58 @@ member functions ([[functions.within.classes]]).
|
|
| 8 |
#### Type descriptions <a id="type.descriptions">[[type.descriptions]]</a>
|
| 9 |
|
| 10 |
##### General <a id="type.descriptions.general">[[type.descriptions.general]]</a>
|
| 11 |
|
| 12 |
The Requirements subclauses may describe names that are used to specify
|
| 13 |
-
constraints on template arguments.[^
|
| 14 |
Clauses to describe the types that may be supplied as arguments by a
|
| 15 |
C++program when instantiating template components from the library.
|
| 16 |
|
| 17 |
Certain types defined in Clause [[input.output]] are used to describe
|
| 18 |
implementation-defined types. They are based on other types, but with
|
| 19 |
added constraints.
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
##### Enumerated types <a id="enumerated.types">[[enumerated.types]]</a>
|
| 22 |
|
| 23 |
Several types defined in Clause [[input.output]] are *enumerated
|
| 24 |
types*. Each enumerated type may be implemented as an enumeration or as
|
| 25 |
-
a synonym for an enumeration.[^
|
| 26 |
|
| 27 |
-
The enumerated type
|
| 28 |
|
| 29 |
``` cpp
|
| 30 |
-
enum enumerated {
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
.....
|
| 37 |
```
|
| 38 |
|
| 39 |
-
Here, the names
|
| 40 |
this particular enumerated type. All such elements have distinct values.
|
| 41 |
|
| 42 |
##### Bitmask types <a id="bitmask.types">[[bitmask.types]]</a>
|
| 43 |
|
| 44 |
Several types defined in Clauses [[language.support]] through
|
|
@@ -48,20 +69,19 @@ operators, as an integer type, or as a `bitset` ([[template.bitset]]).
|
|
| 48 |
|
| 49 |
The bitmask type *bitmask* can be written:
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
// For exposition only.
|
| 53 |
-
// int_type is an integral type capable of
|
| 54 |
-
// representing all values of the bitmask type.
|
| 55 |
enum bitmask : int_type {
|
| 56 |
-
|
| 57 |
};
|
| 58 |
|
| 59 |
-
constexpr bitmask
|
| 60 |
-
constexpr bitmask
|
| 61 |
-
constexpr bitmask
|
| 62 |
-
constexpr bitmask
|
| 63 |
.....
|
| 64 |
|
| 65 |
constexpr bitmask{} operator&(bitmask{} X, bitmask{} Y) {
|
| 66 |
return static_cast<bitmask{}>(
|
| 67 |
static_cast<int_type>(X) & static_cast<int_type>(Y));
|
|
@@ -86,14 +106,14 @@ bitmask{}& operator|=(bitmask{}& X, bitmask{} Y) {
|
|
| 86 |
bitmask{}& operator^=(bitmask{}& X, bitmask{} Y) {
|
| 87 |
X = X ^ Y; return X;
|
| 88 |
}
|
| 89 |
```
|
| 90 |
|
| 91 |
-
Here, the names
|
| 92 |
particular bitmask type. All such elements have distinct, nonzero values
|
| 93 |
-
such that, for any pair
|
| 94 |
-
nonzero and
|
| 95 |
represent an *empty bitmask*, in which no bitmask elements are set.
|
| 96 |
|
| 97 |
The following terms apply to objects and values of bitmask types:
|
| 98 |
|
| 99 |
- To *set* a value *Y* in an object *X* is to evaluate the expression
|
|
@@ -107,83 +127,87 @@ The following terms apply to objects and values of bitmask types:
|
|
| 107 |
|
| 108 |
The C standard library makes widespread use of characters and character
|
| 109 |
sequences that follow a few uniform conventions:
|
| 110 |
|
| 111 |
- A *letter* is any of the 26 lowercase or 26 uppercase letters in the
|
| 112 |
-
basic execution character set.
|
| 113 |
- The *decimal-point character* is the (single-byte) character used by
|
| 114 |
functions that convert between a (single-byte) character sequence and
|
| 115 |
a value of one of the floating-point types. It is used in the
|
| 116 |
character sequence to denote the beginning of a fractional part. It is
|
| 117 |
represented in Clauses [[language.support]] through [[thread]] and
|
| 118 |
Annex [[depr]] by a period, `'.'`, which is also its value in the
|
| 119 |
`"C"` locale, but may change during program execution by a call to
|
| 120 |
-
`setlocale(int, const char*)`,[^
|
| 121 |
object, as described in Clauses [[locales]] and [[input.output]].
|
| 122 |
-
- A *character sequence* is an array object ([[dcl.array]])
|
| 123 |
-
can be declared as `T A[N]`, where
|
| 124 |
`unsigned char`, or `signed char` ([[basic.fundamental]]), optionally
|
| 125 |
qualified by any combination of `const` or `volatile`. The initial
|
| 126 |
elements of the array have defined contents up to and including an
|
| 127 |
element determined by some predicate. A character sequence can be
|
| 128 |
-
designated by a pointer value
|
| 129 |
|
| 130 |
###### Byte strings <a id="byte.strings">[[byte.strings]]</a>
|
| 131 |
|
| 132 |
A *null-terminated byte string*, or NTBS, is a character sequence whose
|
| 133 |
highest-addressed element with defined content has the value zero (the
|
| 134 |
*terminating null* character); no other element in the sequence has the
|
| 135 |
-
value zero. [^
|
| 136 |
|
| 137 |
The *length* of an NTBS is the number of elements that precede the
|
| 138 |
terminating null character. An *empty* NTBS has a length of zero.
|
| 139 |
|
| 140 |
The *value* of an NTBS is the sequence of values of the elements up to
|
| 141 |
and including the terminating null character.
|
| 142 |
|
| 143 |
-
A *static* NTBS is an NTBSwith static storage duration.[^
|
| 144 |
|
| 145 |
###### Multibyte strings <a id="multibyte.strings">[[multibyte.strings]]</a>
|
| 146 |
|
| 147 |
-
A *null-terminated multibyte string
|
| 148 |
constitutes a sequence of valid multibyte characters, beginning and
|
| 149 |
-
ending in the initial shift state.[^
|
| 150 |
|
| 151 |
A *static* NTMBS is an NTMBSwith static storage duration.
|
| 152 |
|
| 153 |
#### Functions within classes <a id="functions.within.classes">[[functions.within.classes]]</a>
|
| 154 |
|
| 155 |
For the sake of exposition, Clauses [[language.support]] through
|
| 156 |
[[thread]] and Annex [[depr]] do not describe copy/move constructors,
|
| 157 |
assignment operators, or (non-virtual) destructors with the same
|
| 158 |
apparent semantics as those that can be generated by default (
|
| 159 |
-
[[class.ctor]], [[class.dtor]], [[class.copy]]).
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
#### Private members <a id="objects.within.classes">[[objects.within.classes]]</a>
|
| 166 |
|
| 167 |
Clauses [[language.support]] through [[thread]] and Annex [[depr]] do
|
| 168 |
not specify the representation of classes, and intentionally omit
|
| 169 |
specification of class members ([[class.mem]]). An implementation may
|
| 170 |
define static or non-static class members, or both, as needed to
|
| 171 |
implement the semantics of the member functions specified in Clauses
|
| 172 |
[[language.support]] through [[thread]] and Annex [[depr]].
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
classes. The declarations for such member objects and the definitions of
|
| 180 |
-
related member types are followed by a comment that ends with
|
| 181 |
-
*exposition only*, as in:
|
| 182 |
|
| 183 |
``` cpp
|
| 184 |
streambuf* sb; // exposition only
|
| 185 |
```
|
| 186 |
|
| 187 |
An implementation may use any technique that provides equivalent
|
| 188 |
-
|
| 189 |
|
|
|
|
| 8 |
#### Type descriptions <a id="type.descriptions">[[type.descriptions]]</a>
|
| 9 |
|
| 10 |
##### General <a id="type.descriptions.general">[[type.descriptions.general]]</a>
|
| 11 |
|
| 12 |
The Requirements subclauses may describe names that are used to specify
|
| 13 |
+
constraints on template arguments.[^6] These names are used in library
|
| 14 |
Clauses to describe the types that may be supplied as arguments by a
|
| 15 |
C++program when instantiating template components from the library.
|
| 16 |
|
| 17 |
Certain types defined in Clause [[input.output]] are used to describe
|
| 18 |
implementation-defined types. They are based on other types, but with
|
| 19 |
added constraints.
|
| 20 |
|
| 21 |
+
##### Exposition-only types <a id="expos.only.types">[[expos.only.types]]</a>
|
| 22 |
+
|
| 23 |
+
Several types defined in Clauses [[language.support]] through
|
| 24 |
+
[[thread]] and Annex [[depr]] that are used as function parameter or
|
| 25 |
+
return types are defined for the purpose of exposition only in order to
|
| 26 |
+
capture their language linkage. The declarations of such types are
|
| 27 |
+
followed by a comment ending in *exposition only*.
|
| 28 |
+
|
| 29 |
+
[*Example 1*:
|
| 30 |
+
|
| 31 |
+
``` cpp
|
| 32 |
+
namespace std {
|
| 33 |
+
extern "C" using some-handler = int(int, void*, double); // exposition only
|
| 34 |
+
}
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
The type placeholder `some-handler` can now be used to specify a
|
| 38 |
+
function that takes a callback parameter with C language linkage.
|
| 39 |
+
|
| 40 |
+
— *end example*]
|
| 41 |
+
|
| 42 |
##### Enumerated types <a id="enumerated.types">[[enumerated.types]]</a>
|
| 43 |
|
| 44 |
Several types defined in Clause [[input.output]] are *enumerated
|
| 45 |
types*. Each enumerated type may be implemented as an enumeration or as
|
| 46 |
+
a synonym for an enumeration.[^7]
|
| 47 |
|
| 48 |
+
The enumerated type `enumerated` can be written:
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
+
enum enumerated { V₀, V₁, V₂, V₃, ..... };
|
| 52 |
|
| 53 |
+
inline const enumerated C₀(V₀);
|
| 54 |
+
inline const enumerated C₁(V₁);
|
| 55 |
+
inline const enumerated C₂(V₂);
|
| 56 |
+
inline const enumerated C₃(V₃);
|
| 57 |
.....
|
| 58 |
```
|
| 59 |
|
| 60 |
+
Here, the names `C₀`, `C₁`, etc. represent *enumerated elements* for
|
| 61 |
this particular enumerated type. All such elements have distinct values.
|
| 62 |
|
| 63 |
##### Bitmask types <a id="bitmask.types">[[bitmask.types]]</a>
|
| 64 |
|
| 65 |
Several types defined in Clauses [[language.support]] through
|
|
|
|
| 69 |
|
| 70 |
The bitmask type *bitmask* can be written:
|
| 71 |
|
| 72 |
``` cpp
|
| 73 |
// For exposition only.
|
| 74 |
+
// int_type is an integral type capable of representing all values of the bitmask type.
|
|
|
|
| 75 |
enum bitmask : int_type {
|
| 76 |
+
V₀ = 1 << 0, V₁ = 1 << 1, V₂ = 1 << 2, V₃ = 1 << 3, .....
|
| 77 |
};
|
| 78 |
|
| 79 |
+
inline constexpr bitmask C₀(V₀{});
|
| 80 |
+
inline constexpr bitmask C₁(V₁{});
|
| 81 |
+
inline constexpr bitmask C₂(V₂{});
|
| 82 |
+
inline constexpr bitmask C₃(V₃{});
|
| 83 |
.....
|
| 84 |
|
| 85 |
constexpr bitmask{} operator&(bitmask{} X, bitmask{} Y) {
|
| 86 |
return static_cast<bitmask{}>(
|
| 87 |
static_cast<int_type>(X) & static_cast<int_type>(Y));
|
|
|
|
| 106 |
bitmask{}& operator^=(bitmask{}& X, bitmask{} Y) {
|
| 107 |
X = X ^ Y; return X;
|
| 108 |
}
|
| 109 |
```
|
| 110 |
|
| 111 |
+
Here, the names `C₀`, `C₁`, etc. represent *bitmask elements* for this
|
| 112 |
particular bitmask type. All such elements have distinct, nonzero values
|
| 113 |
+
such that, for any pair `Cᵢ` and `Cⱼ` where i ≠ j, `C_i & C_i` is
|
| 114 |
+
nonzero and `C_i & C_j` is zero. Additionally, the value `0` is used to
|
| 115 |
represent an *empty bitmask*, in which no bitmask elements are set.
|
| 116 |
|
| 117 |
The following terms apply to objects and values of bitmask types:
|
| 118 |
|
| 119 |
- To *set* a value *Y* in an object *X* is to evaluate the expression
|
|
|
|
| 127 |
|
| 128 |
The C standard library makes widespread use of characters and character
|
| 129 |
sequences that follow a few uniform conventions:
|
| 130 |
|
| 131 |
- A *letter* is any of the 26 lowercase or 26 uppercase letters in the
|
| 132 |
+
basic execution character set.
|
| 133 |
- The *decimal-point character* is the (single-byte) character used by
|
| 134 |
functions that convert between a (single-byte) character sequence and
|
| 135 |
a value of one of the floating-point types. It is used in the
|
| 136 |
character sequence to denote the beginning of a fractional part. It is
|
| 137 |
represented in Clauses [[language.support]] through [[thread]] and
|
| 138 |
Annex [[depr]] by a period, `'.'`, which is also its value in the
|
| 139 |
`"C"` locale, but may change during program execution by a call to
|
| 140 |
+
`setlocale(int, const char*)`,[^8] or by a change to a `locale`
|
| 141 |
object, as described in Clauses [[locales]] and [[input.output]].
|
| 142 |
+
- A *character sequence* is an array object ([[dcl.array]]) `A` that
|
| 143 |
+
can be declared as `T A[N]`, where `T` is any of the types `char`,
|
| 144 |
`unsigned char`, or `signed char` ([[basic.fundamental]]), optionally
|
| 145 |
qualified by any combination of `const` or `volatile`. The initial
|
| 146 |
elements of the array have defined contents up to and including an
|
| 147 |
element determined by some predicate. A character sequence can be
|
| 148 |
+
designated by a pointer value `S` that points to its first element.
|
| 149 |
|
| 150 |
###### Byte strings <a id="byte.strings">[[byte.strings]]</a>
|
| 151 |
|
| 152 |
A *null-terminated byte string*, or NTBS, is a character sequence whose
|
| 153 |
highest-addressed element with defined content has the value zero (the
|
| 154 |
*terminating null* character); no other element in the sequence has the
|
| 155 |
+
value zero. [^9]
|
| 156 |
|
| 157 |
The *length* of an NTBS is the number of elements that precede the
|
| 158 |
terminating null character. An *empty* NTBS has a length of zero.
|
| 159 |
|
| 160 |
The *value* of an NTBS is the sequence of values of the elements up to
|
| 161 |
and including the terminating null character.
|
| 162 |
|
| 163 |
+
A *static* NTBS is an NTBSwith static storage duration.[^10]
|
| 164 |
|
| 165 |
###### Multibyte strings <a id="multibyte.strings">[[multibyte.strings]]</a>
|
| 166 |
|
| 167 |
+
A *null-terminated multibyte string*, or NTMBS, is an NTBSthat
|
| 168 |
constitutes a sequence of valid multibyte characters, beginning and
|
| 169 |
+
ending in the initial shift state.[^11]
|
| 170 |
|
| 171 |
A *static* NTMBS is an NTMBSwith static storage duration.
|
| 172 |
|
| 173 |
#### Functions within classes <a id="functions.within.classes">[[functions.within.classes]]</a>
|
| 174 |
|
| 175 |
For the sake of exposition, Clauses [[language.support]] through
|
| 176 |
[[thread]] and Annex [[depr]] do not describe copy/move constructors,
|
| 177 |
assignment operators, or (non-virtual) destructors with the same
|
| 178 |
apparent semantics as those that can be generated by default (
|
| 179 |
+
[[class.ctor]], [[class.dtor]], [[class.copy]]). It is unspecified
|
| 180 |
+
whether the implementation provides explicit definitions for such member
|
| 181 |
+
function signatures, or for virtual destructors that can be generated by
|
| 182 |
+
default.
|
| 183 |
|
| 184 |
+
For the sake of exposition, the library clauses sometimes annotate
|
| 185 |
+
constructors with \EXPLICIT. Such a constructor is conditionally
|
| 186 |
+
declared as either explicit or non-explicit ([[class.conv.ctor]]).
|
| 187 |
+
|
| 188 |
+
[*Note 1*: This is typically implemented by declaring two such
|
| 189 |
+
constructors, of which at most one participates in overload
|
| 190 |
+
resolution. — *end note*]
|
| 191 |
|
| 192 |
#### Private members <a id="objects.within.classes">[[objects.within.classes]]</a>
|
| 193 |
|
| 194 |
Clauses [[language.support]] through [[thread]] and Annex [[depr]] do
|
| 195 |
not specify the representation of classes, and intentionally omit
|
| 196 |
specification of class members ([[class.mem]]). An implementation may
|
| 197 |
define static or non-static class members, or both, as needed to
|
| 198 |
implement the semantics of the member functions specified in Clauses
|
| 199 |
[[language.support]] through [[thread]] and Annex [[depr]].
|
| 200 |
|
| 201 |
+
For the sake of exposition, some subclauses provide representative
|
| 202 |
+
declarations, and semantic requirements, for private members of classes
|
| 203 |
+
that meet the external specifications of the classes. The declarations
|
| 204 |
+
for such members are followed by a comment that ends with *exposition
|
| 205 |
+
only*, as in:
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
``` cpp
|
| 208 |
streambuf* sb; // exposition only
|
| 209 |
```
|
| 210 |
|
| 211 |
An implementation may use any technique that provides equivalent
|
| 212 |
+
observable behavior.
|
| 213 |
|