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

要求

页眉: <内存>

命名空间: std

请参见

参考

auto_ptr 类