Namespaces
Variants
Actions

std::any::reset

From cppreference.com
< cpp‎ | utility‎ | any
 
C++
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
std::any
void reset() noexcept;
(since C++17)

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

*this does not contain a value after this call.

Contents

[edit] Parameters

(none)

[edit] Return value

(none)

[edit] Example

#include <any>
#include <cassert>
 
int main()
{
    std::any a{42};
    assert(a.has_value();
    a.reset();
    assert(not a.has_value();
}

[edit] See also

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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant