Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
コードで使用しているとしましょうstd::auto_ptr。*
std::auto_ptr
std::auto_ptrオブジェクトを返すことに危険はありますか? つまり、メモリ リークや未定義の動作などを引き起こす可能性はありますか? それとも安全に使用できstd::auto_ptrますか?
*より良い代替品があるかどうかを尋ねているわけshared_ptrではありません(のような); 私は特にauto_ptr自分自身を返すことの落とし穴について尋ねています。
shared_ptr
auto_ptr