ITeye博客

C++ stl中remove的实现

7090 · 2013-09-24 23:14 · 学习C++ · 编程语言 · Markdown

原文:http://www.cplusplus.com/reference/algorithm/remove/

c++98中的实现:

template <class ForwardIterator, class T> ForwardIterator remove (ForwardIterator first, ForwardIterator last, const T& val) { ForwardIterator result = first; while (first!=last) { if (!(*first == val)) { *result = *first; ++result; } ++first; } return result; }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。