简体   繁体   中英

Difference between boost::shared_ptr and std::shared_ptr from the standard <memory> file

我想知道boost::shared_ptr和标准<memory>文件中找到的std::shared_ptr之间是否存在任何差异。

std::shared_ptr is the C++0x form of tr1::shared_ptr , and boost's boost::shared_ptr should behave the same.

However, std::shared_ptr , in an implementation that conforms to C++0x standard, should/might have more convenience behavior on the shared_ptr class, as described in the following links:

The shared_ptr is a reference-counted pointer that acts as much as possible like a regular C++ data pointer. The TR1 implementation lacked certain pointer features such as aliasing and pointer arithmetic, but the C++0x version will add these.

Though from a quick cursory glance, I do not see operator+ and similar arithmetic operations on the shared_ptr type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM