我想知道标准<memory>
文件中找到的boost::shared_ptr
和std::shared_ptr
之间是否有任何区别。来自标准<memory>文件的boost :: shared_ptr和std :: shared_ptr之间的区别
25
A
回答
19
std::shared_ptr
是tr1::shared_ptr
的C++ 0x形式,并且boost的boost::shared_ptr
应该表现相同。
然而,std::shared_ptr
,在符合的C++ 0x标准的实现,应该/可能对shared_ptr
类更多便利的行为,如下面的链接描述:
shared_ptr
是一个引用计数的指针,它像普通的C++数据指针一样尽可能地发挥作用。 TR1实现缺少某些指针功能,如别名和指针算术,但C++ 0x版本将添加这些功能。
虽然从快速粗略地看一眼,我没有看到在shared_ptr
类型operator+
和类似的算术运算。
相关问题
- 1. 如何解决boost :: shared_ptr和使用std :: shared_ptr之间的冲突?
- 2. C++ 0x std :: shared_ptr与boost :: shared_ptr
- 3. C++:std :: shared_ptr <T>和std :: shared_ptr <T const>有什么区别?
- 4. C++中std :: unique_ptr和std :: shared_ptr的区别
- 5. C++中的空std :: shared_ptr与空std :: shared_ptr有什么区别?
- 6. boost :: ptr_container和std :: vector <shared_ptr>
- 7. 这些shared_ptr实例之间的区别?
- 8. 如何处理不断发展的C++ std :: namespace?例如:std :: tr1 :: shared_ptr vs. std :: shared_ptr vs. boost :: shared_ptr vs. boost :: tr1 :: shared_ptr
- 9. QSharedPointer VS std :: tr1 :: shared_ptr VS boost :: tr1 :: shared_ptr
- 10. 维护std :: set <boost :: shared_ptr>
- 11. 非复制std :: shared_ptr <boost::any>?
- 12. 的boost :: shared_ptr的标准集装箱
- 13. std :: enable_if和std :: shared_ptr
- 14. 在使用之前,我应该检查boost :: shared_ptr或std :: shared_ptr吗?
- 15. std :: shared_ptr <Type>和Type^
- 16. typedef boost :: shared_ptr <MyJob> Ptr;或者将#define PTR的boost :: shared_ptr的
- 17. 使用Boost Python&std :: shared_ptr
- 18. C++ 11 std :: shared_ptr + boost :: serialization
- 19. C++ std :: vector <std :: shared_ptr>
- 20. boost :: shared_ptr <const T> boost :: shared_ptr <T>
- 21. boost :: shared_ptr和Inheritance
- 22. std :: array和boost :: array之间的区别
- 23. QCache和std :: shared_ptr的
- 24. 将std :: shared_ptr <char>转换为std :: shared_ptr <unsigned char>
- 25. 使用来自存储shared_ptr的shared_ptr <const T><T>
- 26. 做boost :: shared_ptr <T>和boost :: shared_ptr <const T>分享引用计数?
- 27. std :: stack的深拷贝<boost :: shared_ptr <T>>
- 28. boost :: shared_ptr和dynamic cast
- 29. Casting std :: shared_ptr <T> void *
- 30. boost :: shared_ptr void *反之亦然
这取决于您的实施。 – robert 2011-02-04 19:59:34