std::optional<T>::operator bool, std::optional<T>::has_value
来自cppreference.com
工具库
std::optional
成员函数 | ||||
观察器 | ||||
optional::operator
booloptional::has_value
|
||||
单子操作 | ||||
(C++23)
|
||||
(C++23)
|
||||
(C++23)
|
||||
修改器 | ||||
非成员函数 | ||||
推导指引 | ||||
辅助类 | ||||
辅助对象 | ||||
constexpr
explicit
operator bool()
const
noexcept;
|
(C++17 起) | |
constexpr
bool
has_value()
const
noexcept;
|
(C++17 起) | |
检查 *this 是否含值。
参数
(无)
返回值
若 *this 含值则为 true ,若 *this 不含值则 false 。