Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::out_ptr_t<Smart,Pointer,Args...>::~out_ptr_t

      From cppreference.com
      <cpp‎ |memory‎ |out ptr t
       
       
      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)
      (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)
       
       
      ~out_ptr_t();
      (since C++23)

      Resets the adaptedSmart object by the value of modifiedPointer object (or thevoid* object ifoperatorvoid**() has been called) and the captured arguments.

      Let

      • s denotes the adaptedSmart object,
      • args... denotes the captured arguments,
      • p denotes the value of storedPointer, orstatic_cast<Pointer>(*operatorvoid**()) ifoperatorvoid** has been called,
      • SP be
        • Smart::pointer, if it is valid and denotes a type, otherwise,
        • Smart::element_type*, ifSmart::element_type is valid and denotes a type, otherwise,
        • std::pointer_traits<Smart>::element_type*, ifstd::pointer_traits<Smart>::element_type is valid and denotes a type, otherwise,
        • Pointer.

      Ifs.reset(static_cast<SP>(p),std::forward<Args>(args)...) is well-formed, the destructor performs

      if(p) s.reset(static_cast<SP>(p),std::forward<Args>(args)...);,

      otherwise, ifstd::is_constructible_v<Smart, SP, Args...> istrue, the destructor performs

      if(p) s= Smart(static_cast<SP>(p),std::forward<Args>(args)...);,

      otherwise, the program is ill-formed.

      [edit]Notes

      IfSmart is astd::shared_ptr specialization, the implementation may allocate the storage for the new control block on construction, in order to leave non-throwing works to the destructor.

      Arguments captured by value are destroyed after resetting.

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory/out_ptr_t/%7Eout_ptr_t&oldid=130150"

      [8]ページ先頭

      ©2009-2026 Movatter.jp