• boost algorithm


    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, 6> a{{0, 5, 2, 1, 4, 3}};
      atuo predicate = [](int i) { return i == 4; };
      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(), 4) << std::endl;
      return 0;
    }

    输出为:

    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.

  • 相关阅读:
    Truevision3D
    Django模版渲染后在浏览器中出现空行的问题解决<转>
    python日期函数<转>
    web应用程序概述
    汉诺塔(hanoi)递归实现
    django1.4配置静态文件路径
    服务器端的状态维护
    树的存储结构表示
    WEB服务器端应用程序开发相关概念
    HTTP消息
  • 原文地址:https://www.cnblogs.com/sssblog/p/11139066.html
Copyright © 2020-2023  润新知