Idiomatic use of std::auto_ptr or only use shared_ptr?

前端 未结 5 1310
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 03:12

Now that shared_ptr is in tr1, what do you think should happen to the use of std::auto_ptr? They both have different use cases, but all use cases of

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-04 03:53

    I believe that it's best-practice is to substitute all uses of std::auto_ptr by boost::scoped_ptr unless std::tr1::shared_ptr meets the requirements better, if you don't mind using Boost. On the other hand, it was surely intentional that scoped_ptr wasn't included in TR1.

提交回复
热议问题