#include "pch.h"
#include <iostream>
#include <deque>
#include <string>
#include <list>
#include <algorithm>
#include <vector>
#include <functional>
using namespace std; template<typename InputIterator, typename OutputIterator,typename ElemType, typename Comp>
OutputIterator
filter(InputIterator first, InputIterator last,
      OutputIterator at, const ElemType &val, Comp pred)
{
while((first=find_if(first, last, bind2nd(pred, val)))!=last)
{
cout << "found value:" << *first << endl;
*at++ = *first++;
}
return at;
} int main()
{
const int elem_size = ;
int ia[elem_size] = { ,,,,,,, };
vector<int> ivec(ia,ia+elem_size);
int ia2[elem_size];
vector<int> ivec2(elem_size);
cout << "filtering integer array for values less than 8\n";
filter(ia, ia + elem_size, ia2, elem_size, less<int>());
cout << "filtering integer vector for values greater than 8\n";
filter(ivec.begin(), ivec.end(), ivec2.begin(), elem_size, greater<int>());
return ;
}

functional filter()的更多相关文章

  1. django 操作数据库--orm(object relation mapping)---models

    思想 django为使用一种新的方式,即:关系对象映射(Object Relational Mapping,简称ORM). PHP:activerecord Java:Hibernate C#:Ent ...

  2. Functional Programming without Lambda - Part 1 Functional Composition

    Functions in Java Prior to the introduction of Lambda Expressions feature in version 8, Java had lon ...

  3. 转:LAV Filter 源代码分析

    1: 总体结构 LAV Filter 是一款视频分离和解码软件,他的分离器封装了FFMPEG中的libavformat,解码器则封装了FFMPEG中的libavcodec.它支持十分广泛的视音频格式. ...

  4. ReactiveCocoa与Functional Reactive Programming

    转自 http://blog.leezhong.com/ios/2013/06/19/frp-reactivecocoa.html Functional Reactive Programming(以下 ...

  5. java functional syntax overview

    Defining a Functional Interface @FunctionalInterface public interface TailCall<T> { TailCall&l ...

  6. Starter Set of Functional Interfaces

    Java Development Kit 8 has a number of functional interfaces. Here we review the starter set-the int ...

  7. Demo of Python &quot;Map Reduce Filter&quot;

    Here I share with you a demo for python map, reduce and filter functional programming thatowned by m ...

  8. LAV Filter 源代码分析 4: LAV Video (2)

    上一篇文章分析了LAV Filter 中的LAV Video的两个主要的类:CLAVVideo和CDecodeThread.文章:LAV Filter 源代码分析 3: LAV Video (1) 在 ...

  9. Java Bloom filter几种实现比较

    英文原始出处: Bloom filter for Scala, the fastest for JVM 本文介绍的是用Scala实现的Bloom filter. 源代码在github上.依照性能测试结 ...

随机推荐

  1. LeetCode赛题----Find Left Most Element

    问题描述 Given a binary tree, find the left most element in the last row of the tree. Example 1: Input: ...

  2. HBase性能优化方法总结

    1. 表的设计 1.1 Pre-Creating Regions 默认情况下,在创建HBase表的时候会自动创建一个region分区,当导入数据的时候,所有的HBase客户端都向这一个region写数 ...

  3. 我的CSDN博客&Github地址

    我的 CSDN 博客地址: https://blog.csdn.net/qq_40147863 Github 地址: https://github.com/xpwi

  4. Java多线程学习笔记(三)同步和异步

    首先是一段代码: public class HasSelfPrivateNum { public void addI(String username){ try { int num=0; if(use ...

  5. YII+DWZ三级城市联动挂件

    挂件PHP文件 class CountryCityCombox extends RXWidget { public $provinceId = 2; public $cityId = 3687; pu ...

  6. 全网数据实时备份方案[inotify,sersync]

    环境搭建 0.环境安装   gcc  yum install gcc -y 1.安装inotify(源码软件包) 文件下载:https://files.cnblogs.com/files/ftl101 ...

  7. Exchange2016 & Skype for business 集成之一配置合作伙伴应用程序

    准备条件 为Skype for Business Server和Exchange Server之间建立服务器到服务器的身份验证,您必须做两件事:1)您必须为每台服务器分配合适的证书(详细参考文档htt ...

  8. Asp.Net MVC Identity 2.2.1 使用技巧(八)

    一.添加管理链接 在View/Shared/_layout.cshtml,在页面导航上(28行)添加如下代码: @*通过身份验证并确认用户属于Admin角色显示管理菜单*@ @if (Request. ...

  9. FTP(文件传输协议)工作原理

    目前在网络上,如果你想把文件和其他人共享.最方便的办法莫过于将文件放FTP服务器上,然后其他人通过FTP客户端程序来下载所需要的文件. 1.FTP架构 如同其他的很多通讯协议,FTP通讯协议也采用客户 ...

  10. NJCTF2017 web getflag(详解)

    题目: url:http://218.2.197.235:23725/ writeup: 首先随便输入后查看源码: <imgsrc="data:image/png;base64,Y2F ...