Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿

导航

<2010年7月>
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
统计
  • 随笔 - 379
  • 文章 - 2
  • 评论 - 439
  • 引用 - 0

常用链接

留言簿(26)

随笔分类(335)

随笔档案(379)

文章档案(2)

XYZ

程序员

积分与排名

  • 积分 - 771806
  • 排名 - 19

最新随笔

最新评论

阅读排行榜

评论排行榜

 
#include <iostream>
#include 
<algorithm>

using namespace std;

template
<class I,class F>
get(I from,I to,F f)
{
    I ret 
= to;
    std::sort(from,to,f);
    
while(from != to)
    {
        
if(*from != *(from+1))
        {
            ret 
= from+1;
            
break;
        }
        from 
++;
    }
    
return ret;
}

template
<class T>
bool isLessThen(T a,T b)
{
    
return a < b;
}

int main()
{
    
int arr[] = {2,3,4,5,8,2,9};
    
int* itr = get(arr,arr+7,isLessThen<int>);
    cout 
<<*itr<< endl;
    
return 0;
}
posted on 2017-03-26 09:43 ccsdu2009 阅读(259) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理