void reset() noexcept;
|
(C++17 起) | |
若 *this 含值,则销毁含有的值。
*this 在此调用后不含值。
(无)
(无)
#include <any>
#include <cassert>
int main()
{
std::any a{42};
assert(a.has_value());
a.reset();
assert(not a.has_value());
}
| 检查对象是否含有值 (公开成员函数) [编辑] |