boost的函数:is_partitioned
来源:互联网 发布:搜狐网络大厦地址 编辑:程序博客网 时间:2024/05/22 23:27
template <typename InputIterator, typename UnaryPredicate>bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p ){// Run through the part that satisfy the predicate for ( ; first != last; ++first ) if ( !p (*first)) break;// Now the part that does not satisfy the predicate for ( ; first != last; ++first ) if ( p (*first)) return false; return true;}
功能描述:
容器区间内的元素是否以函数P进行划分;容器区间元素分为两部分,第一部分满足函数要求,第二部分不满足函数要求。
示例:
bool isOdd(int i) {return i % 2 == 1;}bool lessThan10(int i){return i < 10;}int myints[] = {0, 1, 2, 3, 14, 15};vector<int> c(myints, myints + sizeof(myints) / sizeof(int) );is_partitioned ( c, isOdd ); //falseis_partitioned ( c, lessThan10 ); //trueis_partitioned ( c.begin (), c.end (), lessThan10 ); //trueis_partitioned ( c.begin (), c.begin () + 3, lessThan10 ); //trueis_partitioned ( c.end (), c.end (), isOdd ); //true:empty range
0 0
- boost的函数:is_partitioned
- Boost 学习之算法篇 is_partitioned
- C++ is_partitioned
- boost的函数:is_permutation
- boost的函数:partition_point
- 【Boost】基于boost::lexical_cast的to_string函数
- boost函数对象的妙用
- Boost asio的async_write函数
- Boost asio的async_write函数
- Boost asio的async_write函数
- 关于boost::function与boost::bind函数的使用心得
- 关于boost::function与boost::bind函数的使用心得
- Boost的转换函数(一)
- Boost的转换函数(二)
- Boost的转换函数(一)
- Boost的转换函数(二)
- Boost的转换函数polymorphic_cast和polymorphic_downcast
- Boost的转换函数numeric_cast和lexical_cast
- 学习Spring事务处理-非常好的文章列表
- IOS Application生命周期
- leetcode167~Two Sum II
- Android:Layout_weight的深刻理解
- Dubbo后台管理和监控中心部署
- boost的函数:is_partitioned
- 使用Xfermode绘制一个颜色渐变的圆形进度条
- curl 手册
- Matlab 的USB摄像头编程
- 分类算法总结
- shell中的特殊字符【2】
- PHP isset 函数 与 PHP empty 函数
- 如何打开pr_debug调试信息
- 模块化开发-node简介