std::any::reset

来自cppreference.com
< cpp‎ | utility‎ | any
 
 
 
 
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());
}

参阅

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