Class containing auto_ptr stored in vector

前端 未结 5 940
小蘑菇
小蘑菇 2021-01-21 05:42

In an answer to Is it safe to store objects of a class which has an std::auto_ptr as its member variable in std::vector? I stated that a class that contained an auto_ptr could

5条回答
  •  终归单人心
    2021-01-21 06:31

    Since the regular auto_ptr semantic could suggests that the ownership is passed during the copying, I would rather use here boost::scoped_ptr. Of course the assignment operator is missing.

提交回复
热议问题