共用方式為


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 的物件。

傳回值

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

備註

指派的結果,,,才能儲存的指標 myptr 變更指派評估運算式 delete myptr,不過,。 然後將 _Right 存放指標的擁有權,將 _Right。在 myptr版本 。 函式傳回 *this

範例

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

需求

標頭: <memory>

命名空間: std

請參閱

參考

auto_ptr 類別