4 Matching Annotations
- Apr 2022
-
www.learncpp.com www.learncpp.com
-
Second, don’t manually delete the resource out from underneath the std::unique_ptr.
有什么误用
std::unique_ptr
的情况? -
Use std::make_unique() instead of creating std::unique_ptr and using new yourself.
推荐的创建
std::unique_ptr
的方式是什么?有什么好处? -
Favor std::array, std::vector, or std::string over a smart pointer managing a fixed array, dynamic array, or C-style string.
对于固定的 array,动态 array 和字符串,更推荐使用哪种类型?
-
Because std::unique_ptr is designed with move semantics in mind, copy initialization and copy assignment are disabled. If you want to transfer the contents managed by std::unique_ptr, you must use move semantics.
std::unique_ptr
可以使用 copy 初始化吗?
-