[optional.nullopt] (original) (raw)

22 General utilities library [utilities]

22.5 Optional objects [optional]

22.5.4 No-value state indicator [optional.nullopt]

struct nullopt_t{_see below_};inline constexpr nullopt_t nullopt(_unspecified_);

The struct nullopt_t is an empty class type used as a unique type to indicate the state of not containing a value for optional objects.

In particular, optional<T> has a constructor with nullopt_t as a single argument; this indicates that an optional object not containing a value shall be constructed.

Type nullopt_t shall not have a default constructor or an initializer-list constructor, and shall not be an aggregate.