gpt4 book ai didi

c++ - vs2010中的 vector 初始化

转载 作者:行者123 更新时间:2023-11-30 01:54:07 26 4
gpt4 key购买 nike

#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
class M {
vector<string> s;
public:
M(){
s = {"abc", "abc", "abc", "abc", "abc"};
}
};

int main(){
return 0;
}

代码在c9中可以编译,但是在vs2010中却编译不成功,为什么?

最佳答案

MS VC++ 2010 不支持 std::initializer_list 作为标准容器成员函数的参数。

关于c++ - vs2010中的 vector 初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22372879/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com