unique ptr Smart pointer
std::auto_ptr deprecated under c++11 , removed c++17. copy constructor , assignment operators of auto_ptr not copy stored pointer. instead, transfer it, leaving prior auto_ptr object empty. 1 way implement strict ownership, 1 auto_ptr object can own pointer @ given time. means auto_ptr should not used copy semantics needed. since auto_ptr existed copy semantics, not upgraded move-only pointer without breaking backward compatibility existing code.
Comments
Post a Comment