bind1st,bind2nd,not1,not2
来源:互联网 发布:投稿被怀疑数据造假 编辑:程序博客网 时间:2024/05/20 00:49
bind1st和bind2nd函数用于将一个二元算子(binary functor,bf)转换成一元算子(unary functor,uf)
// 移除所有小于100的元素
arr.erase( std::remove_if( arr.begin(), arr.end(),
std::bind2nd( std::less< int>(), 100)), arr.end());
// 移除所有大于100的元素
arr.erase( std::remove_if( arr.begin(), arr.end(),
std::bind1st( std::less< int>(), 100)), arr.end());
// 移除所有大于100的元素
arr.erase( std::remove_if( arr.begin(), arr.end(),
std::bind2nd( std::greater< int>(), 100)), arr.end());
// 移除所有小于等于100的元素
arr.erase( std::remove_if( arr.begin(), arr.end(),
std::not1(std::bind2nd( std::greater< int>(), 100))), arr.end());
not1()和not2()
not1()接受单目函数对象,not2()接受双目函数对象
参考资料:http://blog.csdn.net/lalor/article/details/7975621
http://blog.163.com/liuruigong_lrg/blog/static/2737030620080295843330/
- bind1st,bind2nd,not1,not2
- not1,not2,bind1st和bind2nd详解
- not1 & not2
- 【STL】函数 for_each; bind1st和bind2nd,not1; mem_fun和mem_fun_ref;
- stl中 bind1st和 bind2nd 以及not1等适配器的使用
- bind1st & bind2nd
- mem_fun_ref,mem_fun,not1,not2,ptr_fun
- mem_fun_ref,mem_fun,not1,not2,ptr_fun
- bind1st bind2nd的使用
- 引用 bind1st bind2nd
- bind1st bind2nd的使用
- bind1st bind2nd的使用
- STL bind1st bind2nd详解
- STL bind1st bind2nd详解
- bind1st bind2nd的使用
- bind2nd 和 bind1st【转】
- bind1st bind2nd详解
- bind1st和bind2nd函数
- 日经社説 20150222 撤廃したい有期雇用への規制
- iOS 中json的解析
- NYOJ12 喷水装置(二)【贪心】
- NYOJ12 喷水装置(二)【贪心】
- rman 命令行,直接startup 起db
- bind1st,bind2nd,not1,not2
- BZOJ2456 Mode & zju2132 The Most Frequent Number
- 吉他泛音分析
- HDU-4394 Digital Square(DFS)
- 黑马程序员——正则表达式
- 如何高效的工作
- Python3伪装浏览器爬虫读取网页内容
- 理解PHP对象注入
- Android Nexus6 和iPhone6内置应用对比分析