1. 要使用C++ 11以上版本
2. 要包含下面的头文件
#include <memory>
error: ‘shared_ptr‘ was not declared in this scope_追梦-北极星的博客-CSDN博客
3. 测试代码
#include <iostream>
#include <memory>
using namespace std;
int main() {
// your code goes here
cout<<"999999";
shared_ptr<int> sp1(new int(100));
cout<<"sp1的值: "<<*sp1<<endl;
return 0;
}

https://ideone.com/EmO1xy
2万+

被折叠的 条评论
为什么被折叠?



