shared_ptr和vector配合使用
二维数组使用方式
#include <iostream>
#include <vector>
#include <memory>
using namespace std;
int main(){
vector<string> aa;
vector<vector<string>>str(5);
str.resize(5);
for (int i=0;i<5;i++){
str[i].resize(5);
}
str[0][0]="hello world";
cout<<str[0][0]<<endl;
shared_ptr<vector<vector<string>>> data=make_shared<vector<vector<string>>>(str);
cout<<data.get()<<endl;
cout<<(*(data.get()))[0][0]<<endl;
vector<vector<string>> str2;
str2=*(data.get());
cout<<str2[0][0]<<endl;
return 0;
}