3
A
回答
8
Test* function()
{
std::auto_ptr<Test> test(new Test());
return test.release()
}
3
是否可以将本地创建的auto_ptr指针转换为普通指针。
是:
return test.release();
1
的std :: auto_ptr的的
见释放的方法:http://www.cplusplus.com/reference/std/memory/auto_ptr/release/
相关问题
- 1. 从auto_ptr转换为正常指针
- 2. 常量指针转换
- 3. 指针vs auto_ptr vs shared_ptr
- 4. 指针转换
- 5. JSF转换oneSelectMenu空指针异常
- 6. 类型转换为常量指针
- 7. 转换指针(常数)引用
- 8. 常量无效*指针转换为特定的类指针
- 9. 通行证指针auto_ptr的用C++
- 10. 分配原始指针到auto_ptr
- 11. C++中的自动指针(auto_ptr)
- 12. 智能指针(auto_ptr的)行为
- 13. C++中auto_ptr的指针运算
- 14. 普通指针VS自动指针(标准:: auto_ptr的)
- 15. 为什么将“指针指向非常量”转换为“指向常量指针的指针”
- 16. NULL指针转换
- 17. C++指针转换
- 18. C++禁止指针转换指针
- 19. 指针到指针到const的转换
- 20. 将指数值转换为正常
- 21. 正常指针和常量指针在c中的区别
- 22. 如何将“指向常量TCHAR的指针”转换为“std :: string”?
- 23. 转换为双指针
- 24. INT转换为char *指针
- 25. Java字节[]指针转换
- 26. 转换指针迭代器
- 27. 将指针转换成MemoryStream?
- 28. 类型转换和指针
- 29. 非portale指针转换
- 30. 将int转换为指针
顺便说一句,'的std :: auto_ptr'现在已不支持'std :: unique_ptr'。 –
非常感谢您的宝贵建议 –