#include <iostream>
#include <memory>
using namespace std;
int main()
{
int *vals = new int[10];
vals[0] = 111222;
shared_ptr<int> sp(vals);
unique_ptr<int> vp(vals);
std::cout << vp.get()[0] << std::endl;
std::cout << sp.get()[0] << std::endl;
return 0;
}
智能指针的double free
最新推荐文章于 2024-08-22 10:51:34 发布