In the C-library the type void* is used as generic pointer type. But member functions cannot be
called without a type and user typecasts would be required to operate on the pointer's data. With
C++ templates the user can constitude the type of dump pointer to be stored inside the wrapped
pointer instance.


To get the dump pointer inside the wrapped pointer a few constructors are required. Null pointers
should indicate an unde¯ned destination for smart pointers like they do for dump pointers.
 A null smart pointer can be created with the default constructor that takes no arguments.

Example: SmartPtr<std::string> ptr;
 A copy constructor need to be de¯ned, to initialize a wrapped pointer from another

compatible wrapped pointer instance.

Example: SmartPtr<std::vector> ptr(ptr2);

 To initialize the wrapped pointer from a dump pointer a constructor is needed with the type
of the dump pointer as argument.

Example: SmartPtr<int> ptr(new int(31337));
Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates