【发布时间】:2019-06-28 17:20:59
【问题描述】:
我有一个vector<string> 并使用迭代器,我需要在循环中提取迭代器指向的整个字符串:
vector<string> v;
auto iter = v.begin();
while(iter != v.end()){
auto s = //extract the string corresponding to the current iterator position
}
既然*iter会返回我对应字符串的第一个字符,那怎么办呢?
【问题讨论】:
-
你认为
*iter为什么会给你字符串的第一个字符?你试过了吗?