内存&GT;的boost ::从标准&LT的shared_ptr和std :: shared_ptr的区别;文件 [英] Difference between boost::shared_ptr and std::shared_ptr from the standard <memory> file
问题描述
如果有在的boost :: shared_ptr的
和的std :: shared_ptr的
发现之间的差异,我想知道在标准&LT;存储器GT;
文件。
I was wondering if there are any differences between the boost::shared_ptr
and the std::shared_ptr
found in the standard <memory>
file.
推荐答案
的std :: shared_ptr的
是的C ++ 0x的形式TR1: :shared_ptr的
和提升的的boost :: shared_ptr的
应具有相同的行为。
std::shared_ptr
is the C++0x form of tr1::shared_ptr
, and boost's boost::shared_ptr
should behave the same.
然而,的std :: shared_ptr的
,以符合的C ++ 0x标准的实现,应该/可能对更多便利的行为 shared_ptr的
类,如下面的链接描述:
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:
-
<一个href=\"http://stackoverflow.com/questions/1086798/differences-between-different-flavours-of-shared-ptr\">Differences shared_ptr的
<一个href=\"http://en.wikipedia.org/wiki/C%2B%2B0x#General-purpose_smart_pointers\">http://en.wikipedia.org/wiki/C%2B%2B0x#General-purpose_smart_pointers
的的shared_ptr
是充当尽量像一个普通的C ++数据指针引用计数指针。该TR1实现某些缺乏指针功能,如抗锯齿和指针算法,但C ++ 0x中的版本将添加这些。
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.
- 2010年11月工作草案
中的C ++ 0x
虽然从快速粗略地看一眼,我没有看到运营商+
和类似的算术运算的的shared_ptr
键入。
Though from a quick cursory glance, I do not see operator+
and similar arithmetic operations on the shared_ptr
type.
这篇关于内存&GT;的boost ::从标准&LT的shared_ptr和std :: shared_ptr的区别;文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!