我想标记字符串并添加到向量,但现在我只能通过迭代器访问它们,如下所示。如何将字符串迭代器指向的数据推回到字符串向量中
vector<string> ExprTree::tokenise(string expression){
vector<string> vec;
std::string::iterator it = expression.begin();
while (it != expression.end()) {
cout << "it test " << (*it) << endl;
vec.push_back(*it); // wrong!
it++;
}
当我把(10 + 10) * 5
输出
(
1
0
+
1
0
)
*
5
这是我想要的,但我怎么能真正将其添加到载体?