Namespaces
Variants

std::any::reset

From cppreference.com
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)    
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)



 
 
void reset() noexcept;
(since C++17)

If *this contains a value, destroys the contained value.

*this does not contain a value after this call.

Parameters

(none)

Return value

(none)

Example

#include <any>
#include <cassert>

int main()
{
    std::any a{42};
    assert(a.has_value());
    a.reset();
    assert(not a.has_value());
}

See also

checks if object holds a value
(public member function) [edit]