ACE notes (8) -Ace smart pointer

xiaoxiao2021-03-05  32

ACE notes (8) -Ace smart pointer

The most basic smart pointer needs to include the following file #include "ace / auto_ptr.h"

The purpose of intelligent manufacturing is to avoid complexity of the pointer

Based on the following: Auto_PTR Variable Name (Type Instance or Pointer to Type Instance);, as Auto_Ptr Reactor (New Ace_Reactor (IMPL)); When using a pointer to the type instance, the variable is disengaged. It will automatically release the type instance of the pointer, such as: ace_reactor_impl * impl = new ace_msg_wfmo_reactor; auto_ptr delete_impl (IMPL); to get the pointer owned by the smart pointer, you need to call the intelligent pointer's get () method, such as Reactor. Get ()

ACE Smart Pointer Comparison: Auto_PTR: No copy and assignment syntax ACE_STRONG_BOUND_PTR: You can store objects, but you can't hand over all objects of objects to other objects ACE_REFCOUNTED_PTR: You can also store objects, you can give all the objects owned by it. Other objects, when the Release () method is called, it is set to 0 and returns the pointer it owns.

转载请注明原文地址:https://www.9cbs.com/read-33864.html

New Post(0)