Class containing auto_ptr stored in vector

前端 未结 5 905
小蘑菇
小蘑菇 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:15

    What about the following?

    cout << av[ 0 ] << endl;
    

    Also, conceptually, a copy should leave the item copied from unchanged. This is being violated in your implementation.

    (It is quite another thing that your original code compiles fine with g++ -pedantic ... and Comeau but not VS2005.)

提交回复
热议问题