tmp/tmp2kxpalgx/{from.md → to.md}
RENAMED
|
@@ -1,21 +1,39 @@
|
|
| 1 |
## Comparisons <a id="class.compare">[[class.compare]]</a>
|
| 2 |
|
| 3 |
### Defaulted comparison operator functions <a id="class.compare.default">[[class.compare.default]]</a>
|
| 4 |
|
| 5 |
-
A defaulted comparison operator function [[over.binary]]
|
| 6 |
-
|
| 7 |
|
| 8 |
-
- a non-static member or friend of `C`
|
|
|
|
|
|
|
| 9 |
- either has two parameters of type `const C&` or two parameters of type
|
| 10 |
`C`, where the implicit object parameter (if any) is considered to be
|
| 11 |
the first parameter.
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
A defaulted `<=>` or `==` operator function for class `C` is defined as
|
| 19 |
deleted if any non-static data member of `C` is of reference type or `C`
|
| 20 |
has variant members [[class.union.anon]].
|
| 21 |
|
|
@@ -45,11 +63,11 @@ function has no *noexcept-specifier*, the implicitly-declared `==`
|
|
| 45 |
operator function has an implicit exception specification
|
| 46 |
[[except.spec]] that can differ from the implicit exception
|
| 47 |
specification of the three-way comparison operator
|
| 48 |
function. — *end note*]
|
| 49 |
|
| 50 |
-
[*Example
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
template<typename T> struct X {
|
| 54 |
friend constexpr std::partial_ordering operator<=>(X, X) requires (sizeof(T) != 1) = default;
|
| 55 |
// implicitly declares: friend constexpr bool operator==(X, X) requires (sizeof(T) != 1) = default;
|
|
@@ -84,17 +102,17 @@ declared return type `bool`.
|
|
| 84 |
|
| 85 |
A defaulted `==` operator function for a class `C` is defined as deleted
|
| 86 |
unless, for each `xᵢ` in the expanded list of subobjects for an object
|
| 87 |
`x` of type `C`, `xᵢ`` == ``xᵢ` is usable [[class.compare.default]].
|
| 88 |
|
| 89 |
-
The return value
|
| 90 |
-
|
| 91 |
-
`
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
|
| 97 |
[*Example 1*:
|
| 98 |
|
| 99 |
``` cpp
|
| 100 |
struct D {
|
|
@@ -111,13 +129,13 @@ struct D {
|
|
| 111 |
The *synthesized three-way comparison* of type `R` [[cmp.categories]] of
|
| 112 |
glvalues `a` and `b` of the same type is defined as follows:
|
| 113 |
|
| 114 |
- If `a <=> b` is usable [[class.compare.default]] and can be explicitly
|
| 115 |
converted to `R` using `static_cast`, `static_cast<R>(a <=> b)`.
|
| 116 |
-
- Otherwise, if overload resolution for `a <=> b`
|
| 117 |
-
at least one viable candidate, the synthesized
|
| 118 |
-
not defined.
|
| 119 |
- Otherwise, if `R` is not a comparison category type, or either the
|
| 120 |
expression `a == b` or the expression `a < b` is not usable, the
|
| 121 |
synthesized three-way comparison is not defined.
|
| 122 |
- Otherwise, if `R` is `strong_ordering`, then
|
| 123 |
``` cpp
|
|
@@ -154,19 +172,19 @@ subobjects for an object `x` of type `C`.
|
|
| 154 |
common comparison type (see below) of `R₀`, `R₁`, …, `R_n-1`.
|
| 155 |
- Otherwise, `R` shall not contain a placeholder type. If the
|
| 156 |
synthesized three-way comparison of type `R` between any objects `xᵢ`
|
| 157 |
and `xᵢ` is not defined, the operator function is defined as deleted.
|
| 158 |
|
| 159 |
-
The return value
|
| 160 |
operator function with parameters `x` and `y` of the same type is
|
| 161 |
determined by comparing corresponding elements `xᵢ` and `yᵢ` in the
|
| 162 |
expanded lists of subobjects for `x` and `y` (in increasing index order)
|
| 163 |
until the first index i where the synthesized three-way comparison of
|
| 164 |
type `R` between `xᵢ` and `yᵢ` yields a result value `vᵢ` where
|
| 165 |
-
`vᵢ` `!=` 0, contextually converted to `bool`, yields `true`
|
| 166 |
-
copy of `vᵢ`
|
| 167 |
-
`static_cast<R>(std::strong_ordering::equal)`.
|
| 168 |
|
| 169 |
The *common comparison type* `U` of a possibly-empty list of n
|
| 170 |
comparison category types `T₀`, `T₁`, …, `T_n-1` is defined as follows:
|
| 171 |
|
| 172 |
- If at least one `Tᵢ` is `std::partial_ordering`, `U` is
|
|
@@ -185,18 +203,22 @@ a secondary comparison operator `@` shall have a declared return type
|
|
| 185 |
`bool`.
|
| 186 |
|
| 187 |
The operator function with parameters `x` and `y` is defined as deleted
|
| 188 |
if
|
| 189 |
|
| 190 |
-
- overload resolution [[over.match]], as applied to `x @ y`,
|
| 191 |
-
result in a usable candidate, or
|
| 192 |
-
- the
|
| 193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
-
|
| 196 |
-
function is not considered as a candidate
|
| 197 |
-
the `@
|
| 198 |
|
| 199 |
[*Example 1*:
|
| 200 |
|
| 201 |
``` cpp
|
| 202 |
struct HasNoLessThan { };
|
|
@@ -212,10 +234,12 @@ struct C {
|
|
| 212 |
<!-- Link reference definitions -->
|
| 213 |
[basic.align]: basic.md#basic.align
|
| 214 |
[basic.compound]: basic.md#basic.compound
|
| 215 |
[basic.def]: basic.md#basic.def
|
| 216 |
[basic.def.odr]: basic.md#basic.def.odr
|
|
|
|
|
|
|
| 217 |
[basic.life]: basic.md#basic.life
|
| 218 |
[basic.link]: basic.md#basic.link
|
| 219 |
[basic.lookup]: basic.md#basic.lookup
|
| 220 |
[basic.lookup.elab]: basic.md#basic.lookup.elab
|
| 221 |
[basic.lval]: expr.md#basic.lval
|
|
@@ -227,10 +251,11 @@ struct C {
|
|
| 227 |
[basic.start.term]: basic.md#basic.start.term
|
| 228 |
[basic.stc.auto]: basic.md#basic.stc.auto
|
| 229 |
[basic.stc.static]: basic.md#basic.stc.static
|
| 230 |
[basic.stc.thread]: basic.md#basic.stc.thread
|
| 231 |
[basic.types]: basic.md#basic.types
|
|
|
|
| 232 |
[class]: #class
|
| 233 |
[class.abstract]: #class.abstract
|
| 234 |
[class.access]: #class.access
|
| 235 |
[class.access.base]: #class.access.base
|
| 236 |
[class.access.general]: #class.access.general
|
|
@@ -294,13 +319,15 @@ struct C {
|
|
| 294 |
[cmp.weakord]: support.md#cmp.weakord
|
| 295 |
[conv]: expr.md#conv
|
| 296 |
[conv.mem]: expr.md#conv.mem
|
| 297 |
[conv.ptr]: expr.md#conv.ptr
|
| 298 |
[conv.rval]: expr.md#conv.rval
|
|
|
|
|
|
|
| 299 |
[dcl.array]: dcl.md#dcl.array
|
| 300 |
[dcl.attr.nouniqueaddr]: dcl.md#dcl.attr.nouniqueaddr
|
| 301 |
-
[dcl.
|
| 302 |
[dcl.decl]: dcl.md#dcl.decl
|
| 303 |
[dcl.enum]: dcl.md#dcl.enum
|
| 304 |
[dcl.fct]: dcl.md#dcl.fct
|
| 305 |
[dcl.fct.def]: dcl.md#dcl.fct.def
|
| 306 |
[dcl.fct.def.coroutine]: dcl.md#dcl.fct.def.coroutine
|
|
@@ -314,10 +341,11 @@ struct C {
|
|
| 314 |
[dcl.init.general]: dcl.md#dcl.init.general
|
| 315 |
[dcl.init.list]: dcl.md#dcl.init.list
|
| 316 |
[dcl.init.ref]: dcl.md#dcl.init.ref
|
| 317 |
[dcl.inline]: dcl.md#dcl.inline
|
| 318 |
[dcl.meaning]: dcl.md#dcl.meaning
|
|
|
|
| 319 |
[dcl.name]: dcl.md#dcl.name
|
| 320 |
[dcl.spec.auto]: dcl.md#dcl.spec.auto
|
| 321 |
[dcl.stc]: dcl.md#dcl.stc
|
| 322 |
[dcl.type.cv]: dcl.md#dcl.type.cv
|
| 323 |
[dcl.type.elab]: dcl.md#dcl.type.elab
|
|
@@ -326,14 +354,13 @@ struct C {
|
|
| 326 |
[depr.impldec]: future.md#depr.impldec
|
| 327 |
[depr.static.constexpr]: future.md#depr.static.constexpr
|
| 328 |
[diff.class]: compatibility.md#diff.class
|
| 329 |
[except.ctor]: except.md#except.ctor
|
| 330 |
[except.handle]: except.md#except.handle
|
| 331 |
-
[except.pre]: except.md#except.pre
|
| 332 |
[except.spec]: except.md#except.spec
|
| 333 |
[except.throw]: except.md#except.throw
|
| 334 |
-
[expr.
|
| 335 |
[expr.call]: expr.md#expr.call
|
| 336 |
[expr.cast]: expr.md#expr.cast
|
| 337 |
[expr.const]: expr.md#expr.const
|
| 338 |
[expr.const.cast]: expr.md#expr.const.cast
|
| 339 |
[expr.delete]: expr.md#expr.delete
|
|
@@ -353,39 +380,42 @@ struct C {
|
|
| 353 |
[expr.type.conv]: expr.md#expr.type.conv
|
| 354 |
[expr.typeid]: expr.md#expr.typeid
|
| 355 |
[expr.unary.op]: expr.md#expr.unary.op
|
| 356 |
[intro.execution]: basic.md#intro.execution
|
| 357 |
[intro.object]: basic.md#intro.object
|
|
|
|
|
|
|
| 358 |
[namespace.udecl]: dcl.md#namespace.udecl
|
| 359 |
[over]: over.md#over
|
| 360 |
-
[over.
|
| 361 |
[over.best.ics]: over.md#over.best.ics
|
| 362 |
[over.binary]: over.md#over.binary
|
| 363 |
-
[over.ics.ref]: over.md#over.ics.ref
|
| 364 |
[over.match]: over.md#over.match
|
| 365 |
[over.match.best]: over.md#over.match.best
|
| 366 |
[over.match.call]: over.md#over.match.call
|
| 367 |
[over.match.copy]: over.md#over.match.copy
|
| 368 |
[over.match.funcs]: over.md#over.match.funcs
|
|
|
|
|
|
|
| 369 |
[over.oper]: over.md#over.oper
|
| 370 |
[over.over]: over.md#over.over
|
| 371 |
[special]: #special
|
| 372 |
[stmt.dcl]: stmt.md#stmt.dcl
|
| 373 |
[stmt.return]: stmt.md#stmt.return
|
| 374 |
[string.classes]: strings.md#string.classes
|
| 375 |
[temp.arg]: temp.md#temp.arg
|
| 376 |
[temp.constr]: temp.md#temp.constr
|
| 377 |
[temp.constr.order]: temp.md#temp.constr.order
|
| 378 |
[temp.deduct.guide]: temp.md#temp.deduct.guide
|
| 379 |
-
[temp.dep.type]: temp.md#temp.dep.type
|
| 380 |
[temp.expl.spec]: temp.md#temp.expl.spec
|
| 381 |
[temp.explicit]: temp.md#temp.explicit
|
| 382 |
[temp.friend]: temp.md#temp.friend
|
| 383 |
[temp.inst]: temp.md#temp.inst
|
| 384 |
[temp.mem]: temp.md#temp.mem
|
| 385 |
[temp.param]: temp.md#temp.param
|
| 386 |
[temp.pre]: temp.md#temp.pre
|
|
|
|
| 387 |
[temp.spec.partial]: temp.md#temp.spec.partial
|
| 388 |
[temp.variadic]: temp.md#temp.variadic
|
| 389 |
[term.incomplete.type]: basic.md#term.incomplete.type
|
| 390 |
[term.layout.compatible.type]: basic.md#term.layout.compatible.type
|
| 391 |
[term.object.representation]: basic.md#term.object.representation
|
|
@@ -394,61 +424,46 @@ struct C {
|
|
| 394 |
|
| 395 |
[^1]: This ensures that two subobjects that have the same class type and
|
| 396 |
that belong to the same most derived object are not allocated at the
|
| 397 |
same address [[expr.eq]].
|
| 398 |
|
| 399 |
-
[^2]:
|
| 400 |
-
|
| 401 |
-
[^3]: This implies that the reference parameter of the
|
| 402 |
implicitly-declared copy constructor cannot bind to a `volatile`
|
| 403 |
lvalue; see [[diff.class]].
|
| 404 |
|
| 405 |
-
[^
|
| 406 |
taking an rvalue reference parameter is never a copy assignment
|
| 407 |
operator, the presence of such an assignment operator does not
|
| 408 |
suppress the implicit declaration of a copy assignment operator.
|
| 409 |
Such assignment operators participate in overload resolution with
|
| 410 |
other assignment operators, including copy assignment operators,
|
| 411 |
and, if selected, will be used to assign an object.
|
| 412 |
|
| 413 |
-
[^
|
| 414 |
implicitly-declared copy assignment operator cannot bind to a
|
| 415 |
`volatile` lvalue; see [[diff.class]].
|
| 416 |
|
| 417 |
-
[^
|
| 418 |
-
purposes of overload resolution [[over.best.ics]], [[over.ics.ref]]
|
| 419 |
-
and therefore initialization [[dcl.init]] and explicit casts
|
| 420 |
-
[[expr.static.cast]]. A conversion to `void` does not invoke any
|
| 421 |
-
conversion function [[expr.static.cast]]. Even though never directly
|
| 422 |
-
called to perform a conversion, such conversion functions can be
|
| 423 |
-
declared and can potentially be reached through a call to a virtual
|
| 424 |
-
conversion function in a base class.
|
| 425 |
-
|
| 426 |
-
[^7]: The use of the `virtual` specifier in the declaration of an
|
| 427 |
overriding function is valid but redundant (has empty semantics).
|
| 428 |
|
| 429 |
-
[^
|
| 430 |
still polymorphic even if its internal representation does not
|
| 431 |
otherwise require any additions for that polymorphic behavior.
|
| 432 |
|
| 433 |
-
[^
|
| 434 |
[[over]] as a virtual function is not necessarily virtual and does
|
| 435 |
not override. Access control [[class.access]] is not considered in
|
| 436 |
determining overriding.
|
| 437 |
|
| 438 |
-
[^
|
| 439 |
pointers to classes are not allowed.
|
| 440 |
|
| 441 |
-
[^
|
| 442 |
and local classes.
|
| 443 |
|
| 444 |
-
[^
|
| 445 |
base class remain inaccessible even to derived classes unless friend
|
| 446 |
declarations within the base class definition are used to grant
|
| 447 |
access explicitly.
|
| 448 |
|
| 449 |
-
[^
|
| 450 |
static data members or enumerator member constants.
|
| 451 |
-
|
| 452 |
-
[^14]: Because only one object is destroyed instead of two, and one
|
| 453 |
-
copy/move constructor is not executed, there is still one object
|
| 454 |
-
destroyed for each one constructed.
|
|
|
|
| 1 |
## Comparisons <a id="class.compare">[[class.compare]]</a>
|
| 2 |
|
| 3 |
### Defaulted comparison operator functions <a id="class.compare.default">[[class.compare.default]]</a>
|
| 4 |
|
| 5 |
+
A defaulted comparison operator function [[over.binary]] shall be a
|
| 6 |
+
non-template function that
|
| 7 |
|
| 8 |
+
- is a non-static member or friend of some class `C`,
|
| 9 |
+
- is defined as defaulted in `C` or in a context where `C` is complete,
|
| 10 |
+
and
|
| 11 |
- either has two parameters of type `const C&` or two parameters of type
|
| 12 |
`C`, where the implicit object parameter (if any) is considered to be
|
| 13 |
the first parameter.
|
| 14 |
|
| 15 |
+
Such a comparison operator function is termed a defaulted comparison
|
| 16 |
+
operator function for class `C`. Name lookups and access checks in the
|
| 17 |
+
implicit definition [[dcl.fct.def.default]] of a comparison operator
|
| 18 |
+
function are performed from a context equivalent to its *function-body*.
|
| 19 |
+
A definition of a comparison operator as defaulted that appears in a
|
| 20 |
+
class shall be the first declaration of that function.
|
| 21 |
+
|
| 22 |
+
[*Example 1*:
|
| 23 |
+
|
| 24 |
+
``` cpp
|
| 25 |
+
struct S;
|
| 26 |
+
bool operator==(S, S) = default; // error: S is not complete
|
| 27 |
+
struct S {
|
| 28 |
+
friend bool operator==(S, const S&) = default; // error: parameters of different types
|
| 29 |
+
};
|
| 30 |
+
enum E { };
|
| 31 |
+
bool operator==(E, E) = default; // error: not a member or friend of a class
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
— *end example*]
|
| 35 |
|
| 36 |
A defaulted `<=>` or `==` operator function for class `C` is defined as
|
| 37 |
deleted if any non-static data member of `C` is of reference type or `C`
|
| 38 |
has variant members [[class.union.anon]].
|
| 39 |
|
|
|
|
| 63 |
operator function has an implicit exception specification
|
| 64 |
[[except.spec]] that can differ from the implicit exception
|
| 65 |
specification of the three-way comparison operator
|
| 66 |
function. — *end note*]
|
| 67 |
|
| 68 |
+
[*Example 2*:
|
| 69 |
|
| 70 |
``` cpp
|
| 71 |
template<typename T> struct X {
|
| 72 |
friend constexpr std::partial_ordering operator<=>(X, X) requires (sizeof(T) != 1) = default;
|
| 73 |
// implicitly declares: friend constexpr bool operator==(X, X) requires (sizeof(T) != 1) = default;
|
|
|
|
| 102 |
|
| 103 |
A defaulted `==` operator function for a class `C` is defined as deleted
|
| 104 |
unless, for each `xᵢ` in the expanded list of subobjects for an object
|
| 105 |
`x` of type `C`, `xᵢ`` == ``xᵢ` is usable [[class.compare.default]].
|
| 106 |
|
| 107 |
+
The return value of a defaulted `==` operator function with parameters
|
| 108 |
+
`x` and `y` is determined by comparing corresponding elements `xᵢ` and
|
| 109 |
+
`yᵢ` in the expanded lists of subobjects for `x` and `y` (in increasing
|
| 110 |
+
index order) until the first index i where `xᵢ`` == ``yᵢ` yields a
|
| 111 |
+
result value which, when contextually converted to `bool`, yields
|
| 112 |
+
`false`. The return value is `false` if such an index exists and `true`
|
| 113 |
+
otherwise.
|
| 114 |
|
| 115 |
[*Example 1*:
|
| 116 |
|
| 117 |
``` cpp
|
| 118 |
struct D {
|
|
|
|
| 129 |
The *synthesized three-way comparison* of type `R` [[cmp.categories]] of
|
| 130 |
glvalues `a` and `b` of the same type is defined as follows:
|
| 131 |
|
| 132 |
- If `a <=> b` is usable [[class.compare.default]] and can be explicitly
|
| 133 |
converted to `R` using `static_cast`, `static_cast<R>(a <=> b)`.
|
| 134 |
+
- Otherwise, if `a <=> b` is usable or overload resolution for `a <=> b`
|
| 135 |
+
is performed and finds at least one viable candidate, the synthesized
|
| 136 |
+
three-way comparison is not defined.
|
| 137 |
- Otherwise, if `R` is not a comparison category type, or either the
|
| 138 |
expression `a == b` or the expression `a < b` is not usable, the
|
| 139 |
synthesized three-way comparison is not defined.
|
| 140 |
- Otherwise, if `R` is `strong_ordering`, then
|
| 141 |
``` cpp
|
|
|
|
| 172 |
common comparison type (see below) of `R₀`, `R₁`, …, `R_n-1`.
|
| 173 |
- Otherwise, `R` shall not contain a placeholder type. If the
|
| 174 |
synthesized three-way comparison of type `R` between any objects `xᵢ`
|
| 175 |
and `xᵢ` is not defined, the operator function is defined as deleted.
|
| 176 |
|
| 177 |
+
The return value of type `R` of the defaulted three-way comparison
|
| 178 |
operator function with parameters `x` and `y` of the same type is
|
| 179 |
determined by comparing corresponding elements `xᵢ` and `yᵢ` in the
|
| 180 |
expanded lists of subobjects for `x` and `y` (in increasing index order)
|
| 181 |
until the first index i where the synthesized three-way comparison of
|
| 182 |
type `R` between `xᵢ` and `yᵢ` yields a result value `vᵢ` where
|
| 183 |
+
`vᵢ` `!=` 0, contextually converted to `bool`, yields `true`. The return
|
| 184 |
+
value is a copy of `vᵢ` if such an index exists and
|
| 185 |
+
`static_cast<R>(std::strong_ordering::equal)` otherwise.
|
| 186 |
|
| 187 |
The *common comparison type* `U` of a possibly-empty list of n
|
| 188 |
comparison category types `T₀`, `T₁`, …, `T_n-1` is defined as follows:
|
| 189 |
|
| 190 |
- If at least one `Tᵢ` is `std::partial_ordering`, `U` is
|
|
|
|
| 203 |
`bool`.
|
| 204 |
|
| 205 |
The operator function with parameters `x` and `y` is defined as deleted
|
| 206 |
if
|
| 207 |
|
| 208 |
+
- a first overload resolution [[over.match]], as applied to `x @ y`,
|
| 209 |
+
- does not result in a usable candidate, or
|
| 210 |
+
- the selected candidate is not a rewritten candidate, or
|
| 211 |
+
- a second overload resolution for the expression resulting from the
|
| 212 |
+
interpretation of `x @ y` using the selected rewritten candidate
|
| 213 |
+
[[over.match.oper]] does not result in a usable candidate (for
|
| 214 |
+
example, that expression might be `(x <=> y) @ 0`), or
|
| 215 |
+
- `x @ y` cannot be implicitly converted to `bool`.
|
| 216 |
|
| 217 |
+
In any of the two overload resolutions above, the defaulted operator
|
| 218 |
+
function is not considered as a candidate for the `@` operator.
|
| 219 |
+
Otherwise, the operator function yields `x @ y`.
|
| 220 |
|
| 221 |
[*Example 1*:
|
| 222 |
|
| 223 |
``` cpp
|
| 224 |
struct HasNoLessThan { };
|
|
|
|
| 234 |
<!-- Link reference definitions -->
|
| 235 |
[basic.align]: basic.md#basic.align
|
| 236 |
[basic.compound]: basic.md#basic.compound
|
| 237 |
[basic.def]: basic.md#basic.def
|
| 238 |
[basic.def.odr]: basic.md#basic.def.odr
|
| 239 |
+
[basic.fundamental]: basic.md#basic.fundamental
|
| 240 |
+
[basic.indet]: basic.md#basic.indet
|
| 241 |
[basic.life]: basic.md#basic.life
|
| 242 |
[basic.link]: basic.md#basic.link
|
| 243 |
[basic.lookup]: basic.md#basic.lookup
|
| 244 |
[basic.lookup.elab]: basic.md#basic.lookup.elab
|
| 245 |
[basic.lval]: expr.md#basic.lval
|
|
|
|
| 251 |
[basic.start.term]: basic.md#basic.start.term
|
| 252 |
[basic.stc.auto]: basic.md#basic.stc.auto
|
| 253 |
[basic.stc.static]: basic.md#basic.stc.static
|
| 254 |
[basic.stc.thread]: basic.md#basic.stc.thread
|
| 255 |
[basic.types]: basic.md#basic.types
|
| 256 |
+
[basic.types.general]: basic.md#basic.types.general
|
| 257 |
[class]: #class
|
| 258 |
[class.abstract]: #class.abstract
|
| 259 |
[class.access]: #class.access
|
| 260 |
[class.access.base]: #class.access.base
|
| 261 |
[class.access.general]: #class.access.general
|
|
|
|
| 319 |
[cmp.weakord]: support.md#cmp.weakord
|
| 320 |
[conv]: expr.md#conv
|
| 321 |
[conv.mem]: expr.md#conv.mem
|
| 322 |
[conv.ptr]: expr.md#conv.ptr
|
| 323 |
[conv.rval]: expr.md#conv.rval
|
| 324 |
+
[cpp.cond]: cpp.md#cpp.cond
|
| 325 |
+
[dcl.align]: dcl.md#dcl.align
|
| 326 |
[dcl.array]: dcl.md#dcl.array
|
| 327 |
[dcl.attr.nouniqueaddr]: dcl.md#dcl.attr.nouniqueaddr
|
| 328 |
+
[dcl.contract.func]: dcl.md#dcl.contract.func
|
| 329 |
[dcl.decl]: dcl.md#dcl.decl
|
| 330 |
[dcl.enum]: dcl.md#dcl.enum
|
| 331 |
[dcl.fct]: dcl.md#dcl.fct
|
| 332 |
[dcl.fct.def]: dcl.md#dcl.fct.def
|
| 333 |
[dcl.fct.def.coroutine]: dcl.md#dcl.fct.def.coroutine
|
|
|
|
| 341 |
[dcl.init.general]: dcl.md#dcl.init.general
|
| 342 |
[dcl.init.list]: dcl.md#dcl.init.list
|
| 343 |
[dcl.init.ref]: dcl.md#dcl.init.ref
|
| 344 |
[dcl.inline]: dcl.md#dcl.inline
|
| 345 |
[dcl.meaning]: dcl.md#dcl.meaning
|
| 346 |
+
[dcl.meaning.general]: dcl.md#dcl.meaning.general
|
| 347 |
[dcl.name]: dcl.md#dcl.name
|
| 348 |
[dcl.spec.auto]: dcl.md#dcl.spec.auto
|
| 349 |
[dcl.stc]: dcl.md#dcl.stc
|
| 350 |
[dcl.type.cv]: dcl.md#dcl.type.cv
|
| 351 |
[dcl.type.elab]: dcl.md#dcl.type.elab
|
|
|
|
| 354 |
[depr.impldec]: future.md#depr.impldec
|
| 355 |
[depr.static.constexpr]: future.md#depr.static.constexpr
|
| 356 |
[diff.class]: compatibility.md#diff.class
|
| 357 |
[except.ctor]: except.md#except.ctor
|
| 358 |
[except.handle]: except.md#except.handle
|
|
|
|
| 359 |
[except.spec]: except.md#except.spec
|
| 360 |
[except.throw]: except.md#except.throw
|
| 361 |
+
[expr.assign]: expr.md#expr.assign
|
| 362 |
[expr.call]: expr.md#expr.call
|
| 363 |
[expr.cast]: expr.md#expr.cast
|
| 364 |
[expr.const]: expr.md#expr.const
|
| 365 |
[expr.const.cast]: expr.md#expr.const.cast
|
| 366 |
[expr.delete]: expr.md#expr.delete
|
|
|
|
| 380 |
[expr.type.conv]: expr.md#expr.type.conv
|
| 381 |
[expr.typeid]: expr.md#expr.typeid
|
| 382 |
[expr.unary.op]: expr.md#expr.unary.op
|
| 383 |
[intro.execution]: basic.md#intro.execution
|
| 384 |
[intro.object]: basic.md#intro.object
|
| 385 |
+
[meta.reflection.define.aggregate]: meta.md#meta.reflection.define.aggregate
|
| 386 |
+
[module.reach]: module.md#module.reach
|
| 387 |
[namespace.udecl]: dcl.md#namespace.udecl
|
| 388 |
[over]: over.md#over
|
| 389 |
+
[over.assign]: over.md#over.assign
|
| 390 |
[over.best.ics]: over.md#over.best.ics
|
| 391 |
[over.binary]: over.md#over.binary
|
|
|
|
| 392 |
[over.match]: over.md#over.match
|
| 393 |
[over.match.best]: over.md#over.match.best
|
| 394 |
[over.match.call]: over.md#over.match.call
|
| 395 |
[over.match.copy]: over.md#over.match.copy
|
| 396 |
[over.match.funcs]: over.md#over.match.funcs
|
| 397 |
+
[over.match.general]: over.md#over.match.general
|
| 398 |
+
[over.match.oper]: over.md#over.match.oper
|
| 399 |
[over.oper]: over.md#over.oper
|
| 400 |
[over.over]: over.md#over.over
|
| 401 |
[special]: #special
|
| 402 |
[stmt.dcl]: stmt.md#stmt.dcl
|
| 403 |
[stmt.return]: stmt.md#stmt.return
|
| 404 |
[string.classes]: strings.md#string.classes
|
| 405 |
[temp.arg]: temp.md#temp.arg
|
| 406 |
[temp.constr]: temp.md#temp.constr
|
| 407 |
[temp.constr.order]: temp.md#temp.constr.order
|
| 408 |
[temp.deduct.guide]: temp.md#temp.deduct.guide
|
|
|
|
| 409 |
[temp.expl.spec]: temp.md#temp.expl.spec
|
| 410 |
[temp.explicit]: temp.md#temp.explicit
|
| 411 |
[temp.friend]: temp.md#temp.friend
|
| 412 |
[temp.inst]: temp.md#temp.inst
|
| 413 |
[temp.mem]: temp.md#temp.mem
|
| 414 |
[temp.param]: temp.md#temp.param
|
| 415 |
[temp.pre]: temp.md#temp.pre
|
| 416 |
+
[temp.spec.general]: temp.md#temp.spec.general
|
| 417 |
[temp.spec.partial]: temp.md#temp.spec.partial
|
| 418 |
[temp.variadic]: temp.md#temp.variadic
|
| 419 |
[term.incomplete.type]: basic.md#term.incomplete.type
|
| 420 |
[term.layout.compatible.type]: basic.md#term.layout.compatible.type
|
| 421 |
[term.object.representation]: basic.md#term.object.representation
|
|
|
|
| 424 |
|
| 425 |
[^1]: This ensures that two subobjects that have the same class type and
|
| 426 |
that belong to the same most derived object are not allocated at the
|
| 427 |
same address [[expr.eq]].
|
| 428 |
|
| 429 |
+
[^2]: This implies that the reference parameter of the
|
|
|
|
|
|
|
| 430 |
implicitly-declared copy constructor cannot bind to a `volatile`
|
| 431 |
lvalue; see [[diff.class]].
|
| 432 |
|
| 433 |
+
[^3]: Because a template assignment operator or an assignment operator
|
| 434 |
taking an rvalue reference parameter is never a copy assignment
|
| 435 |
operator, the presence of such an assignment operator does not
|
| 436 |
suppress the implicit declaration of a copy assignment operator.
|
| 437 |
Such assignment operators participate in overload resolution with
|
| 438 |
other assignment operators, including copy assignment operators,
|
| 439 |
and, if selected, will be used to assign an object.
|
| 440 |
|
| 441 |
+
[^4]: This implies that the reference parameter of the
|
| 442 |
implicitly-declared copy assignment operator cannot bind to a
|
| 443 |
`volatile` lvalue; see [[diff.class]].
|
| 444 |
|
| 445 |
+
[^5]: The use of the `virtual` specifier in the declaration of an
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
overriding function is valid but redundant (has empty semantics).
|
| 447 |
|
| 448 |
+
[^6]: If all virtual functions are immediate functions, the class is
|
| 449 |
still polymorphic even if its internal representation does not
|
| 450 |
otherwise require any additions for that polymorphic behavior.
|
| 451 |
|
| 452 |
+
[^7]: A function with the same name but a different parameter list
|
| 453 |
[[over]] as a virtual function is not necessarily virtual and does
|
| 454 |
not override. Access control [[class.access]] is not considered in
|
| 455 |
determining overriding.
|
| 456 |
|
| 457 |
+
[^8]: Multi-level pointers to classes or references to multi-level
|
| 458 |
pointers to classes are not allowed.
|
| 459 |
|
| 460 |
+
[^9]: Access permissions are thus transitive and cumulative to nested
|
| 461 |
and local classes.
|
| 462 |
|
| 463 |
+
[^10]: As specified previously in [[class.access]], private members of a
|
| 464 |
base class remain inaccessible even to derived classes unless friend
|
| 465 |
declarations within the base class definition are used to grant
|
| 466 |
access explicitly.
|
| 467 |
|
| 468 |
+
[^11]: This additional check does not apply to other members, e.g.,
|
| 469 |
static data members or enumerator member constants.
|
|
|
|
|
|
|
|
|
|
|
|