BOost Algorithm provides algorithms that complement the algorithms from the standard library. Unlike Boost Range, Boost Algorithm doesn't introduce new concepts. The algorithms defined by Boost Algorithm resemble the algorithms from the standard library.

#include <boost/algorithm/cxx11/one_of.hpp>
#include <array>
#include <iostream> using namespace boost::algorithm; int main() {
std::array<int, > a{{, , , , , }};
atuo predicate = [](int i) { return i == ; };
std::cout.setf(std::ios::boolalpha);
std::cout << one_of(a.begin(), a.end(), predicate) << std;:endl;
std::cout << one_of_equal(a.begin(), a.end(), ) << std::endl;
return ;
}

输出为:

true

true

boost::algorithm::one_of() tests whether a condition is met exactly once. The condition to test is passed as a predicate.

Boost Algorithm also defines the following functions: boost::algorithm::all_of_equal(), boost::algorithm::any_of_equal() and boost::algorithm::none_of_equal().

Boost.Algorithm provides more algorithms from the C++11 standard library. For example, you have access to boost::algorithm::is_partitioned(), boost::algorithm::is_permutation(), boost::algorithm::copy_n(), boost::algorithm::find_if_not() and boost::algorithm::iota(). These  functions work like the indentically named functions from the C++11 standard library and are provided for developers who don't use C++11.

boost algorithm的更多相关文章

  1. boost::algorithm(字符串算法库)

    没什么说的,需要 #include<boost/algorithm/string.hpp> 1.大小写转换 std::string s("test string"); ...

  2. boost::algorithm用法详解之字符串关系判断

    http://blog.csdn.net/qingzai_/article/details/44417937 下面先列举几个常用的: #define i_end_with boost::iends_w ...

  3. 第116讲 boost::algorithm::string之替换和删除

    http://www.360doc.com/content/16/0523/18/29304643_561672752.shtml

  4. boost之algorithm/string

    头文件: #include<iostream>#include <boost/algorithm/string.hpp>using namespace std;using na ...

  5. boost string algorithm

    The Boost.StringAlgorithms library provides many free-standing functions for string manipulation. 1. ...

  6. boost字符串算法

    boost::algorithm简介 2007-12-08 16:59 boost::algorithm提供了很多字符串算法,包括: 大小写转换: 去除无效字符: 谓词: 查找: 删除/替换: 切割: ...

  7. boost之bind

    bind1st bind2nd在stl里面有具体的实现,只是只能绑定两个参数. boost里面的bind使用bind(Fun f,A1 a1,A2,a2...)产生一个对象,这个对象可以有占位符,可以 ...

  8. 使用BOOST BIND库提高C++程序性能

    Boost.Bind为函数和函数对象,值语义和指针提供语义了一致的语法.我们首先通过一些简单的例子来看看它的基本用法,之后我们会延伸到嵌套绑定以实现功能组合.理解bind用法的一个关键是理解占位符(p ...

  9. (九)boost库之文件处理filesystem

    (九)boost库之文件处理filesystem   filesystem库是一个可移植的文件系统操作库,它在底层做了大量的工作,使用POSIX标准表示文件系统的路径,使C++具有了类似脚本语言的功能 ...

随机推荐

  1. Linux 两台服务器之间传递文件

    参考: https://www.cnblogs.com/clovershell/p/9870603.html linux采用scp命令拷贝文件到本地,拷贝本地文件到远程服务器   // 假设远程服务器 ...

  2. for的循环题

    package Tony2;import java.util.Scanner; public class Day27 { public static void main(String[] args) ...

  3. Vue Cli 3:创建项目

    一 简介 Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统,有几个独立的部分. 1 CLI (@vue/cli) 是一个全局安装的 npm 包,提供了终端里的 vue 命令.(vue ...

  4. virtualenv-windows下排坑

    1. 安装 pip install virtualenv pip install virtualenvwrapper-win    (win下一定要有这个 -win,不然后续 workon,mkvir ...

  5. Python List append()方法

    append() 方法用于在列表末尾添加新的对象.Grammar: list.append(obj) 参数obj — 添加到列表末尾的对象.返回值该方法无返回值,但是会修改原来的列表.Case: al ...

  6. Docker 换源

    近几天又折腾起 docker来了    我发现自己在拉镜像的时候,总是超时    然后百度了一下  说要换源 90sec的一个水友 推荐了我 阿里云的加速源    我看了还是免费就想试一下 讲一下过程 ...

  7. HTML5--sessionStorage、localStorage、manifest

    sessionStroage: <!DOCTYPE html> <html lang="en"> <head> <meta charset ...

  8. Codeforces 1061C (DP+滚动数组)

    题面 传送门 分析 考虑DP 设\(dp[i][j]\)表示前i个数选出的序列长度为j的方案数 状态转移方程为: \[ dp[i][j]= \begin{cases}dp\left[ i-1\righ ...

  9. Linux笔记1-简介

    以下为观看兄弟连视频教程所记. 1.简介 1965年,MIT.GE.AT&T的贝尔实验室 --> Multics 分时.庞大 1969年,贝尔实验室的肯·汤普森 --> Unix ...

  10. 攻防世界--re1

    练习文件下载:https://www.lanzous.com/i5lufub 1.使用IDA打开,进入main函数. 2.转为C代码 可以看到,输入v9之后,与v5比较,判断我们输入的flag是否正确 ...