From Jason Turner

[nullablepointer.requirements]

Diff to HTML by rtfpessoa

tmp/tmp7pnr8n0m/{from.md → to.md} RENAMED
@@ -2,22 +2,21 @@
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`.
@@ -25,23 +24,23 @@ place of `p`.
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` | | |
46
 
47
 
 
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*, *Cpp17Swappable*, and
8
  *Cpp17Destructible* requirements,
 
9
  - the expressions shown in [[cpp17.nullablepointer]] are valid and have
10
  the indicated semantics, and
11
  - `P` meets all the other requirements of this subclause.
12
 
13
  A value-initialized object of type `P` produces the null value of the
14
  type. The null value shall be equivalent only to itself. A
15
  default-initialized object of type `P` may have an indeterminate value.
16
 
17
+ [*Note 1*: Operations involving indeterminate values can cause
18
  undefined behavior. — *end note*]
19
 
20
  An object `p` of type `P` can be contextually converted to `bool`
21
  [[conv]]. The effect shall be as if `p != nullptr` had been evaluated in
22
  place of `p`.
 
24
  No operation which is part of the *Cpp17NullablePointer* requirements
25
  shall exit via an exception.
26
 
27
  In [[cpp17.nullablepointer]], `u` denotes an identifier, `t` denotes a
28
  non-`const` lvalue of type `P`, `a` and `b` denote values of type
29
+ (possibly const) `P`, and `np` denotes a value of type (possibly const)
30
+ `std::nullptr_t`.
31
 
32
  **Table: Cpp17NullablePointer requirements** <a id="cpp17.nullablepointer">[cpp17.nullablepointer]</a>
33
 
34
  | Expression | Return type | Operational semantics |
35
+ | -------------- | ------------------------------------------------------------------------- | --------------------------- |
36
  | `P u(np);`<br> | | Ensures: `u == nullptr` |
37
  | `P u = np;` | | |
38
  | `P(np)` | | Ensures: `P(np) == nullptr` |
39
  | `t = np` | `P&` | Ensures: `t == nullptr` |
40
+ | `a != b` | `decltype(a != b)` models `boolean-testable` | `!(a == b)` |
41
+ | `a == np` | `decltype(a == np)` and `decltype(np == a)` each model `boolean-testable` | `a == P()` |
42
  | `np == a` | | |
43
+ | `a != np` | `decltype(a != np)` and `decltype(np != a)` each model `boolean-testable` | `!(a == np)` |
44
  | `np != a` | | |
45
 
46