std::experimental:: nullopt_t
| Technical Specification | ||||
| Filesystem library (filesystem TS) | ||||
| Library fundamentals (library fundamentals TS) | ||||
| Library fundamentals 2 (library fundamentals TS v2) | ||||
| Library fundamentals 3 (library fundamentals TS v3) | ||||
| Extensions for parallelism (parallelism TS) | ||||
| Extensions for parallelism 2 (parallelism TS v2) | ||||
| Extensions for concurrency (concurrency TS) | ||||
| Extensions for concurrency 2 (concurrency TS v2) | ||||
| Concepts (concepts TS) | ||||
| Ranges (ranges TS) | ||||
| Reflection (reflection TS) | ||||
| Mathematical special functions (special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
| Member functions | ||||
| Observers | ||||
| Modifiers | ||||
| Non-member functions | ||||
| Helper classes | ||||
|
nullopt_t
|
||||
| Helper objects | ||||
|
定义于头文件
<experimental/optional>
|
||
|
struct
nullopt_t
;
|
(库基础技术规范) | |
std::experimental::nullopt_t
是一个空类类型,用于表示处于未初始化状态的
optional
类型。特别地,
std::
experimental
::
optional
具有以
nullopt_t
作为单一参数的构造函数,该构造函数会创建一个不包含值的 optional 对象。
std::experimental::nullopt_t
必须是一个
字面类型
且不能拥有默认构造函数。
它必须具有一个接受某些实现定义的字面类型的
constexpr
构造函数。
注释
nullopt_t
不满足
默认构造要求
,这是为了同时支持
op
=
{
}
;
和
op
=
nullopt
;
这两种用于解构可选对象的语法。
该类的一种可能实现是
struct nullopt_t { constexpr nullopt_t(int) {} };
参见
|
(C++17)
|
nullopt_t
类型的对象
(常量) |