What is the difference between Boost smart pointers and std smart pointers?

前端 未结 3 1233
被撕碎了的回忆
被撕碎了的回忆 2021-02-19 09:24

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::sh

3条回答
  •  别跟我提以往
    2021-02-19 10:05

    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.

    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.

提交回复
热议问题