64,649
社区成员
发帖
与我相关
我的任务
分享
void TextQuery::filter_text()
{
if ( filt_elems.empty() )return;
vector<string> *words = text_locations ->first;
vector<string>::iterator iter = words ->begin();
vector<string>::iterator iter_end = words ->end();
while ( iter != iter_end )
{
string::size_type pos = 0;
while (( pos = (*iter).find_first_of( filt_elems, pos ))!= string::npos )
(*iter).erase(pos,1);
++iter;
}
}
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> strvec;
strvec.push_back("hello ");
strvec.push_back("world!");
for(vector<string>::iterator iter=strvec.begin();iter!=strvec.end();++iter)
{
cout<<*iter<<endl;
}
return 0;
}