Is auto_ptr deprecated?

后端 未结 4 1401
深忆病人
深忆病人 2020-11-30 23:57
  1. Will auto_ptr be deprecated in incoming C++ standard?
  2. Should unique_ptr be used for ownership transfer instead of shared_ptr?
  3. If unique_ptr is not in
4条回答
  •  温柔的废话
    2020-12-01 00:13

    Yes, as of today auto_ptr will be deprecated in C++0x and you should use unique_ptr instead. From the latest draft standard (n3035), section D.9

    The class template auto_ptr is deprecated. [ Note: The class template unique_ptr (20.9.10) provides a better solution. —end note ]

    Until the standard is ratified, it's always possible that the committee will revise this decision although I feel that is unlikely for this decision.

提交回复
热议问题