modern-cpp-tutorial
modern-cpp-tutorial copied to clipboard
Clarify safety of `std::unique_ptr`
resolve #282
Description
Clarify under which conditions unique_ptr guarantees safety, because it can't introduce absolute safety.
Change List
- Add description regarding the non-copyability of
unique_ptr
Reference
-
std::unique_ptr<T,Deleter>::unique_ptr- cppreference.com -
std::unique_ptr<T,Deleter>::operator=- cppreference.com - [unique.ptr.single.ctor]
- [unique.ptr.single.asgn]
- [unique.ptr.runtime.ctor]
- [unique.ptr.runtime.asgn]
说明
澄清 unique_ptr 在何种情况下保证安全,因为它不可能带来绝对的安全。
变化箱单
- 增加了
unique_ptr不可复制相关的说明