#include <iostream>
#include <memory>
using namespace std;
int main()
{
int *p5 = new int;
std::shared_ptr<int> p6(p5);
std::shared_ptr<int> p7(p5);// logic error
return 0;
}
这样一个代码,很多人都说有问题,可是我用了好几个编译器编译执行,都一点问题也没有,为什么
#include <iostream>
#include <memory>
using namespace std;
int main()
{
int *p5 = new int;
std::shared_ptr<int> p6(p5);
std::shared_ptr<int> p7(p5);// logic error
return 0;
}
这样一个代码,很多人都说有问题,可是我用了好几个编译器编译执行,都一点问题也没有,为什么