嗨,我是 C++ 的新手,我无法使用 {} 初始化向量,即使代码是用书复制的。例如,当我做这些
vector <string> articles {"a", "an", "the"};
和
vector <string> articles = {"a", "an", "the"};
我分别收到这些错误消息:
Error: expected a ";"
和
Error: initialization with "{...}" is not allowed for object of type "std::vector<std::string, std::allocator<std::string>>"
有人会帮我吗?我相信这应该是一个我无法发现的简单错误。