Files
2025-10-25 03:02:53 +03:00

29 lines
1013 B
Markdown

[optional.nullopt]
# 22 General utilities library [[utilities]](./#utilities)
## 22.5 Optional objects [[optional]](optional#nullopt)
### 22.5.5 No-value state indicator [optional.nullopt]
[🔗](#lib:nullopt_t)
`struct nullopt_t{see below};
inline constexpr nullopt_t nullopt(unspecified);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L4998)
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[.](#1.sentence-1)
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[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L5003)
Type nullopt_t shall not have a default constructor or an initializer-list constructor, and shall not be an aggregate[.](#2.sentence-1)