Namespaces
Variants

std::any:: reset

From cppreference.net
Utilities library
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());
}

参见

检查对象是否持有值
(公开成员函数)