STL-泛型算法示例
2015-10-30 18:58
417 查看
#include"algorithm"
#include"vector"
#include"functional"
#include"iostream"
#include"cstdlib"
using namespace std;
template
void process(Iterator begin,Iterator end,Act act,Test
test)
{
for(;begin!=end;begin++)
if(test(*begin))
act(*begin);
}
#include"vector"
#include"functional"
#include"iostream"
#include"cstdlib"
using namespace std;
template
void process(Iterator begin,Iterator end,Act act,Test
test)
{
for(;begin!=end;begin++)
if(test(*begin))
act(*begin);
}
相关文章推荐
- STL-初始化实验
- STL-访问向量信息
- STL-向量插入/删除
- STL-vector中reserve和resize的区…
- STL-list的访问与遍历
- STL-list插入与删除
- STL-list成员的删除
- STL-list存储格式探究
- STL-list中的spilce()
- STL-list中的merge()
- STL-stack
- STL-单向队列queue
- FTM的PWM、输入捕获、正交解码
- 当程序猿修真,这个世界会怎样!
- 易经的数学模型
- 货币数字转换为中文大写格式
- cmd 组合命令和管道命令的使用
- 将博客搬至CSDN
- P99、面试题13:在o(1)时间删除链表结点
- 昂贵的聘礼(坑爹的枚举+bellmanford)