什么是加速智能指针和std智能指针之间的区别? [英] What is the difference between Boost smart pointers and std smart pointers?
问题描述
所以,我想使用智能指针,而不是原始的,几乎每一个主题的SO说,大约Boost库。但性病有这样的事情的std :: auto_ptr的
和的std :: shared_ptr的
。
为什么提升?有什么区别?
So, I'd like to use smart pointers instead of raw and almost every topic on SO says about Boost library. But std has such things as std::auto_ptr
and std::shared_ptr
.
Why Boost? What is the difference?
推荐答案
基本上升压做的shared_ptr
第一。你可能注意到,许多新的容器类在C ++ 11人升压很久以前。我希望这种模式继续与C ++标准的下一个版本了。升压支持旧的C ++编译器不谈论C ++ 11,这是一个很大的好处。
Basically Boost did shared_ptr
first. You may note that many of the new container classes in C++11 were in Boost long ago. I would expect this pattern to continue with the next revisions of the C++ standard, too. Boost supports older C++ compilers that don't talk C++11, which is a big benefit.
顺便说一句,的std :: auto_ptr的
是德precated在C ++ 11,这带来了的std :: shared_ptr的
和的std ::的unique_ptr
来代替,这两者都是显著更加有用。
Incidentally, std::auto_ptr
is deprecated in C++11, which brings in std::shared_ptr
and std::unique_ptr
instead, which are both significantly more useful.
这篇关于什么是加速智能指针和std智能指针之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!