求教这段程序哪错误
程序代码:
#include<iostream> #include<memory> #include<string> #include<vector> using namespace std; class Strblob { public: typedef vector<string>::size_type size_type; Strblob(); Strblob(vector<string> a); void printfff() { for (auto a : *data) { cout << a << endl; } } private: shared_ptr <vector<string>> data; }; Strblob::Strblob() :data(make_shared<vector<string>>){} Strblob::Strblob(vector<string>a): data(make_shared<vector<string>>(a)){} int main() { Strblob a = { { "a", "b", "c" } }; Strblob b = a; b.printfff(); getchar(); }
编译时出错了。说delete不能删除不是指针的对象。我搞不清楚哪段代码用了delete。