#include<algorithm>
#include<string>
#include<new>
#include<memory>
#include<vector>
using std::vector;
using namespace std;
int main()
{
shared_ptr<vector<int> > pointer=make_shared<vector<int>> ({2,3,5,8});
cout<<(*pointer)[3];
return 0;
所以make_shared不能初始化为({2,3,5,8}),为什么? }
答案 0 :(得分:0)
函数selectedOption
无法转发初始化列表。如果需要使用初始化列表构造函数,则必须直接调用make_shared
构造函数。