【发布时间】:2012-11-30 18:00:00
【问题描述】:
我需要这样在类中初始化向量
vector<string> test("hello","world");
但是当我这样做时,编译器将它识别为一个函数并给我类似的错误 错误:字符串常量等之前的预期标识符。
当我这样做时
vector<string> test = ("hello","world")
没关系..有什么方法可以用vector<string> test("xx")方式做到吗?
【问题讨论】:
-
你确定
vector<string> test = ("hello","world")做了你认为的事情吗?