共用方式為


unique_ptr::swap

若要在兩個 unique_ptr 物件之間的指標。

void swap(unique_ptr& _Right);

參數

  • _Right
    unique_ptr 可用來交換指標。

備註

成員函式交換 stored_ptr 、 right.stored_ptr 、 stored_deleter 和 right.stored_deleter。

需求

標頭: <memory>

命名空間: std

請參閱

參考

unique_ptr 類別

<memory>

C++ 標準程式庫中的執行緒安全

其他資源

unique_ptr 成員

<memory> 成員