Replacing auto_ptr in VC++ 8

后端 未结 7 1478
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:52

    Use a unique_ptr. I think these were introduced to be a better auto_ptr.

    http://www.boost.org/doc/libs/1_35_0/doc/html/interprocess/interprocess_smart_ptr.html#interprocess.interprocess_smart_ptr.unique_ptr

    In fact, I'm led to believe auto_ptr may be deprecated in favour of it:

    http://objectmix.com/c/113487-std-auto_ptr-deprecated.html

提交回复
热议问题