diff --git a/book/en-us/05-pointers.md b/book/en-us/05-pointers.md index dab6df9..71c1e85 100644 --- a/book/en-us/05-pointers.md +++ b/book/en-us/05-pointers.md @@ -82,7 +82,7 @@ std::cout << "pointer3.use_count() = " ## 5.3 `std::unique_ptr` -`std::unique_ptr` is an exclusive smart pointer that prohibits other smart pointers from sharing the same object, thus keeping the code safe: +`std::unique_ptr` is an exclusive smart pointer that prohibits other smart pointers from sharing the same object by copy construction or copy assignment, thus avoiding errors due to repeated destruction or freeing: ```cpp std::unique_ptr pointer = std::make_unique(10); // make_unique, from C++14 diff --git a/book/zh-cn/05-pointers.md b/book/zh-cn/05-pointers.md index ef7467f..fc5c320 100644 --- a/book/zh-cn/05-pointers.md +++ b/book/zh-cn/05-pointers.md @@ -80,7 +80,7 @@ std::cout << "pointer3.use_count() = " ## 5.3 `std::unique_ptr` -`std::unique_ptr` 是一种独占的智能指针,它禁止其他智能指针与其共享同一个对象,从而保证代码的安全: +`std::unique_ptr` 是一种独占的智能指针,它禁止其他智能指针经由拷贝构造或拷贝赋值的方式与其共享同一个对象,从而避免重复析构或释放带来的错误: ```cpp std::unique_ptr pointer = std::make_unique(10); // make_unique 从 C++14 引入