首页 > 其他 > 详细

count_if,智能指针

时间:2014-11-19 12:11:23      阅读:228      评论:0      收藏:0      [点我收藏+]

//count_if       //c++11

vector<int> vec

int cnt = count_if(vec.begin(),vec.end(),[](int i){return i >=80;});

 

 

6.常用的智能指针:

a)      Boost库提供了scoped_ptr/shared_ptr

b)     C++11内置了unique_ptr/shared_ptr

c)      C++98提供auto_ptr已经被废弃

7.Integer(int i)提供了一种从int转化到Integer的能力,而operator int() 提供了从Integer转化成int的能力。

a)      禁用第一种能力,使用explicit关键字。

b)     禁用第二种,直接删除函数即可

6.IO流实现了operator bool() 转化符。

7.[](int i){return i >= 90;} 叫做lamdba表达式,是一种匿名函数。(C++11特性)

 

count_if,智能指针

原文:http://www.cnblogs.com/hzqin/p/4107721.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!