共用方式為


CAutoPtr::operator =

The assignment operator.

template< >
CAutoPtr< T > & operator =(
   CAutoPtr< T > & p 
);
template< typename TSrc >
CAutoPtr< T > & operator =(
   CAutoPtr< TSrc > & p 
);

Parameters

  • p
    A pointer.

  • TSrc
    A class type.

Return Value

Returns a reference to a CAutoPtr< T >.

Remarks

The assignment operator detaches the CAutoPtr object from any current pointer and attaches the new pointer, p, in its place.

Example

See the example in the CAutoPtr Overview.

Requirements

Header: atlbase.h

See Also

Concepts

CAutoPtr Class

CAutoPtr Members

CAutoPtr::Attach

CAutoPtr::Detach