Logo Search packages:      
Sourcecode: znc version File versions

template<typename T>
CSmartPtr<T>& CSmartPtr< T >::operator= ( const CSmartPtr< T > &  CopyFrom  )  [inline]

Copies an existing CSmartPtr adding another reference to the counter.

Parameters:
CopyFrom A reference to another CSmartPtr to be copied
Returns:
Reference to self

Definition at line 507 of file Utils.h.

                                                             {
            if (&CopyFrom != this) {                        // Check for assignment to self
                  Release();                                      // Release the current pointer

                  if (CopyFrom.IsNull()) {                  // If the source raw pointer is null
                        return *this;                             // Then just bail out
                  }

                  m_pType = &(*CopyFrom);                   // Make our pointers reference the same raw pointer and counter
                  m_puCount = CopyFrom.GetCount();

                  if (m_pType) {                                  // If we now point to something valid, increment the counter
                        assert(m_puCount);
                        (*m_puCount)++;
                  }
            }

            return *this;
      }


Generated by  Doxygen 1.6.0   Back to index