摘要: std::shared_ptr p{ new int(100) }; AI回答说这个是生成了长度为100的数组: 实际上,这段代码是以下代码的智能指针写法: int *p=new int; *p=100; 其实长度只有1。 从C++20支持了智能指针的动态数组写法: std::shared_ptr< 阅读全文
posted @ 2025-07-14 11:07 范哥范小飞 阅读(6) 评论(0) 推荐(0)