The created wrapped pointer class o®ers no more functionality than any dump pointer. To add some smartness to the code skeleton a strategy needs to be implemented. Before going into an implementation some strategies will be discussed. The list of strategies is not complete but should be su±cient for most applications. Every strategy is entirely de¯ned by the characteristics of the assignment operators and the de- structor. Let ptr1 and ptr2 be smart pointers. Possible strategies for ptr1 = ptr2 and reset() are described for each strategy. Scoped pointer The scoped pointer is rarely used. It stores a pointer to a dynamically allocated object. The object pointed to is guaranteed to be deleted, either on destruction of the scoped pointer, or via an explicit reset(). The assignment ptr1 = ptr2 is forbidden. Since a scoped pointer is noncopyable it is caved within its scope and cannot get out. It's safer than the reference counting or ownership transfer pointers for poin...
Learn C++ Programming fast and easy, find C++ Program Codes