A Cpp17NullablePointer type is a pointer-like type that supports null values.

A type P satisfies the Cpp17NullablePointer requirements if:

- P satisfies the Cpp17EqualityComparable, Cpp17DefaultConstructible, Cpp17CopyConstructible, Cpp17CopyAssignable, and Cpp17Destructible requirements,
- lvalues of type P are swappable,
- the expressions shown in Table 30 are valid and have the indicated semantics, and
- P satisfies all the other requirements of this subclause.

A value-initialized object of type P produces the null value of the type.

The null value shall be equivalent only to itself.

A default-initialized object
of type P may have an indeterminate value.

In Table 30, u denotes an identifier, t
denotes a non-const lvalue of type P, a and b
denote values of type (possibly const) P, and np denotes
a value of type (possibly const) std::nullptr_t.

Table 30 — Cpp17NullablePointer requirements

Expression | Return type | Operational semantics |

P u(np); | Ensures: u == nullptr | |

P u = np; | ||

P(np) | Ensures: P(np) == nullptr | |

t = np | P& | Ensures: t == nullptr |

a != b | contextually convertible to bool | !(a == b) |

a == np | contextually convertible to bool | a == P() |

np == a | ||

a != np | contextually convertible to bool | !(a == np) |

np != a |