Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::declare_reachable

      From cppreference.com
      <cpp‎ |memory
       
       
      Memory management library
      (exposition only*)
      Allocators
      Uninitialized memory algorithms
      Constrained uninitialized memory algorithms
      Memory resources
      Uninitialized storage(until C++20)
      (until C++20*)
      (until C++20*)
      Garbage collector support(until C++23)
      declare_reachable
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
       
      Defined in header<memory>
      void declare_reachable(void* p);
      (since C++11)
      (removed in C++23)

      Declares the object referenced by the pointerp reachable. Reachable objects will not be deleted by the garbage collector or considered to be a leak by a leak detector even if all pointers to it are destroyed. An object may be declared reachable multiple times, in which case multiple calls tostd::undeclare_reachable would be needed to remove this property. For example, aXOR linked list needs to declare its nodes reachable if the implementation has garbage collection enabled.

      Contents

      [edit]Parameters

      p - a safely-derived pointer or a null pointer

      [edit]Return value

      (none)

      [edit]Exceptions

      May throwstd::bad_alloc if the system cannot allocate memory required to track reachable objects.

      [edit]See also

      (C++11)(removed in C++23)
      declares that an object can be recycled
      (function template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory/gc/declare_reachable&oldid=153322"

      [8]ページ先頭

      ©2009-2025 Movatter.jp