This class is used to ensure that a "new"ed object of type T will be "delete"d when the scope is closed. During destruction, automatically call "delete" on the pointer supplied during construction.
eg. f()
    {
          int* p = new int;
        if (!p)  return OUTOFMEMORY;
        w_auto_delete_t<int> autodel(p);
         ... do work ...
        if (error)  {    // no need to call delete p
        return error;
        }
        // no need to call delete p
        return OK;
    }
delete p will be called by the autodel object. Thus users do not need to code 'delete p' explicitly, and can be assured that p will be deleted when the scope in which autodel was constructed is closed.
This code predates the STL.
Definition at line 94 of file w_autodel.h.
Public Member Functions | |
| NORET | w_auto_delete_t () | 
| NORET | w_auto_delete_t (T *t) | 
| NORET | ~w_auto_delete_t () | 
| w_auto_delete_t & | set (T *t) | 
| T * | operator-> () | 
| T & | operator * () | 
| operator T * () | |
| T const * | operator-> () const | 
| T const & | operator * () const | 
| operator T const * () const | |
 1.4.7