From Jason Turner

[nullablepointer.requirements]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpimsr2n3m/{from.md → to.md} +23 -23
tmp/tmpimsr2n3m/{from.md → to.md} RENAMED
@@ -1,45 +1,45 @@
1
- #### `NullablePointer` requirements <a id="nullablepointer.requirements">[[nullablepointer.requirements]]</a>
2
 
3
- A `NullablePointer` type is a pointer-like type that supports null
4
- values. A type `P` meets the requirements of `NullablePointer` if:
5
 
6
- - `P` satisfies the requirements of `EqualityComparable`,
7
- `DefaultConstructible`, `CopyConstructible`, `CopyAssignable`, and
8
- `Destructible`,
9
- - lvalues of type `P` are swappable ([[swappable.requirements]]),
10
- - the expressions shown in Table  [[tab:nullablepointer]] are valid and
11
- have the indicated semantics, and
12
- - `P` satisfies all the other requirements of this subclause.
13
 
14
  A value-initialized object of type `P` produces the null value of the
15
  type. The null value shall be equivalent only to itself. A
16
  default-initialized object of type `P` may have an indeterminate value.
17
 
18
  [*Note 1*: Operations involving indeterminate values may cause
19
  undefined behavior. — *end note*]
20
 
21
  An object `p` of type `P` can be contextually converted to `bool`
22
- (Clause  [[conv]]). The effect shall be as if `p != nullptr` had been
23
- evaluated in place of `p`.
24
 
25
- No operation which is part of the `NullablePointer` requirements shall
26
- exit via an exception.
27
 
28
- In Table  [[tab:nullablepointer]], `u` denotes an identifier, `t`
29
- denotes a non-`const` lvalue of type `P`, `a` and `b` denote values of
30
- type (possibly `const`) `P`, and `np` denotes a value of type (possibly
31
  `const`) `std::nullptr_t`.
32
 
33
- **Table: `NullablePointer` requirements** <a id="nullablepointer">[nullablepointer]</a>
34
 
35
- | | | |
36
- | -------------- | ---------------------------------- | ---------------------------------- |
37
- | `P u(np);`<br> | | Postconditions: `u == nullptr` |
38
  | `P u = np;` | | |
39
- | `P(np)` | | Postconditions: `P(np) == nullptr` |
40
- | `t = np` | `P&` | Postconditions: `t == nullptr` |
41
  | `a != b` | contextually convertible to `bool` | `!(a == b)` |
42
  | `a == np` | contextually convertible to `bool` | `a == P()` |
43
  | `np == a` | | |
44
  | `a != np` | contextually convertible to `bool` | `!(a == np)` |
45
  | `np != a` | | |
 
1
+ #### *Cpp17NullablePointer* requirements <a id="nullablepointer.requirements">[[nullablepointer.requirements]]</a>
2
 
3
+ A *Cpp17NullablePointer* type is a pointer-like type that supports null
4
+ values. A type `P` meets the *Cpp17NullablePointer* requirements if:
5
 
6
+ - `P` meets the *Cpp17EqualityComparable*, *Cpp17DefaultConstructible*,
7
+ *Cpp17CopyConstructible*, *Cpp17CopyAssignable*, and
8
+ *Cpp17Destructible* requirements,
9
+ - lvalues of type `P` are swappable [[swappable.requirements]],
10
+ - the expressions shown in [[cpp17.nullablepointer]] are valid and have
11
+ the indicated semantics, and
12
+ - `P` meets all the other requirements of this subclause.
13
 
14
  A value-initialized object of type `P` produces the null value of the
15
  type. The null value shall be equivalent only to itself. A
16
  default-initialized object of type `P` may have an indeterminate value.
17
 
18
  [*Note 1*: Operations involving indeterminate values may cause
19
  undefined behavior. — *end note*]
20
 
21
  An object `p` of type `P` can be contextually converted to `bool`
22
+ [[conv]]. The effect shall be as if `p != nullptr` had been evaluated in
23
+ place of `p`.
24
 
25
+ No operation which is part of the *Cpp17NullablePointer* requirements
26
+ shall exit via an exception.
27
 
28
+ In [[cpp17.nullablepointer]], `u` denotes an identifier, `t` denotes a
29
+ non-`const` lvalue of type `P`, `a` and `b` denote values of type
30
+ (possibly `const`) `P`, and `np` denotes a value of type (possibly
31
  `const`) `std::nullptr_t`.
32
 
33
+ **Table: Cpp17NullablePointer requirements** <a id="cpp17.nullablepointer">[cpp17.nullablepointer]</a>
34
 
35
+ | Expression | Return type | Operational semantics |
36
+ | -------------- | ---------------------------------- | --------------------------- |
37
+ | `P u(np);`<br> | | Ensures: `u == nullptr` |
38
  | `P u = np;` | | |
39
+ | `P(np)` | | Ensures: `P(np) == nullptr` |
40
+ | `t = np` | `P&` | Ensures: `t == nullptr` |
41
  | `a != b` | contextually convertible to `bool` | `!(a == b)` |
42
  | `a == np` | contextually convertible to `bool` | `a == P()` |
43
  | `np == a` | | |
44
  | `a != np` | contextually convertible to `bool` | `!(a == np)` |
45
  | `np != a` | | |