智能指针分配动态数组
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                智能指针分配动态数组
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                ?? ?auto ptr_arr = std::make_shared<int[]>();
?? ?std::unique_ptr<int[]> up1(new int[10]());
?? ?//C++14以后語法
 ?? ?auto up2 = std::make_unique<A[]>(3);
?? ?auto sp3(std::shared_ptr<A[]>(new A[3]));
? ?//#include <boost/make_shared.hpp>
?? ?auto b_ptr_arr = boost::make_shared<A[]>(3);
結論,c++14之前,不支持make_unique,c++20之前不支持std::make_shared創建數組
總結
以上是生活随笔為你收集整理的智能指针分配动态数组的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: axios跨域携带cookie_vue
- 下一篇: 玩玩短视频平台和网课平台开发1——腾讯云
