共用方式為


auto_ptr::operator =

從一 auto_ptr 物件擁有權轉移到另一個的指派運算子。

template<class Other>
   auto_ptr<Type>& operator=(
      auto_ptr<Other>& _Right
   ) throw( );
auto_ptr<Type>& operator=(
   auto_ptr<Type>& _Right
) throw( );
auto_ptr<Type>& operator=(
   auto_ptr_ref<Type> _Right
) throw( );

參數

  • _Right
    型別 auto_ptr 的物件。

傳回值

在型別 auto_ptr<[型別]>物件的參考。

備註

因為工作,,,只有在儲存的指標 myptr 變更指派評估運算式 delete myptr,不過,。 然後將 _Right 儲存的指標的擁有權,將 _Right。在 myptr發行 。 函式會傳回 *this

範例

如需使用成員的範例運算子,請參閱 auto_ptr::auto_ptr

需求

標題: <memory>

命名空間: std

請參閱

參考

auto_ptr Class