Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::any::~any

      From cppreference.com
      <cpp‎ |utility‎ |any
       
       
      Utilities library
       
       
      ~any();
      (since C++17)

      Destroys the contained object, if any, as if by a call toreset().

      [edit]Example

      Run this code
      #include <any>#include <cstdio> struct X{    X(){std::puts("X::X()");}    X(const X&){std::puts("X::X(const X&)");}    ~X(){std::puts("X::~X()");}}; int main(){std::any a{X{}};std::puts("Leaving main()...");}

      Output:

      X::X()X::X(const X&)X::~X()Leaving main()...X::~X()

      [edit]See also

      destroys contained object
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/any/%7Eany&oldid=179368"

      [8]ページ先頭

      ©2009-2025 Movatter.jp