std::remove_if
template<class ForwardIterator, class UnaryPredicate>
ForwardIterator remove_if(ForwardIterator first,ForwardIterator last,UnaryPredicate pred);
作用:在algorithm头文件中,将[first,last)这个区域中的某些元素(对于pred方法为true的元素)移去,并返回一个iterator(指向新的区域的past-the-end元素)
这个方法并不会改变container的大小,只是会用紧接着的元素来替代那些要remove掉的元素
用法:
word.erase(std::remove_if(word.begin(),word.end(),ispunct),word.end());
// remove the punctuation character in a string