std::swap(std::unique_ptr)

template< class T, class Deleter >
void swap( unique_ptr<T,Deleter>& lhs, unique_ptr<T,Deleter>& rhs ) noexcept;
(C++11 起)

std::unique_ptr 特化 std::swap 算法。交换 lhsrhs 的指针。调用 lhs.swap(rhs)

此函数不参与重载决议,除非 std::is_swappable<D>::value 为 true 。

(C++17 起)

目录

参数

lhs, rhs - 要交换内容的智能指针

返回值

(无)

复杂度

常数

参阅

交换两个对象的值
(函数模板)
交换内容
(公开成员函数)

版本历史

  • (当前 | 先前 2012年11月2日 (五) 14:00P12bot讨论 | 贡献 . . (312字节) (+281). . (r2.7.3) (机器人添加:de, en, es, fr, it, ja, pt, ru) (撤销)
  • 当前 | 先前 2012年10月25日 (四) 14:56P12讨论 | 贡献 . . (31字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前) 2012年10月22日 (一) 14:48TranslationBot讨论 | 贡献. . (31字节) (+31). . (Translated from the English version using Google Translate)