命名空间
变体
操作

std::any::reset

来自 cppreference.cn
< cpp‎ | 工具‎ | 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());
}

[编辑] 参阅

检查对象是否包含值
(公有成员函数) [编辑]