Replacing auto_ptr in VC++ 8

后端 未结 7 1474
Happy的楠姐
Happy的楠姐 2021-02-14 17:31

std::auto_ptr is broken in VC++ 8 (which is what we use at work). My main gripe with it is that it allows auto_ptr x = new T();, which of cour

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-14 17:32

    Use boost::shared_ptr/boost::scoped_ptr. It will be the preferred smart pointer in upcoming C++ standards (is in TR1 already).

    Edit: Please find a related discussion here: Idiomatic use of std::auto_ptr or only use shared_ptr?

提交回复
热议问题