std :: auto_ptrを通常のポインタに変換できますか?auto_ptrから通常のポインタへの変換
ローカルで作成されたauto_ptrポインタを通常のポインタに変換することは可能ですか?
std :: auto_ptrを通常のポインタに変換できますか?auto_ptrから通常のポインタへの変換
ローカルで作成されたauto_ptrポインタを通常のポインタに変換することは可能ですか?
Test* function()
{
std::auto_ptr<Test> test(new Test());
return test.release()
}
ローカルに作成されたauto_ptrポインタを通常のポインタに変換することは可能ですか?
はい:
return test.release();
参照解除方法:http://www.cplusplus.com/reference/std/memory/auto_ptr/release/
ところで、 'のstd :: auto_ptr'は現在支持して廃止されました'std :: unique_ptr'を実行します。 –
貴重なご意見ありがとうございました –