Boost C++ 库

...全球最受推崇、设计最精良的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu, C++ Coding Standards

Boost 算法库 - Boost C++ 函数库
Next

Boost 算法库

Marshall Clow

根据 Boost 软件许可证版本 1.0 发布。(参见随附文件 LICENSE_1_0.txt 或在 https://boost.ac.cn/LICENSE_1_0.txt 复制)

目录

描述与原理
搜索算法
Boyer-Moore 搜索
Boyer-Moore-Horspool 搜索
Knuth-Morris-Pratt 搜索
C++11 算法
all_of
any_of
none_of
one_of
is_sorted
is_partitioned
is_permutation
partition_point
partition_copy
copy_if
copy_n
iota
C++14 算法
equal
mismatch
C++17 算法
for_each_n
transform_inclusive_scan
transform_exclusive_scan
copy 变体
copy_until
copy_while
copy_if_until
copy_if_while
其他算法
none_of_equal
one_of_equal
is_decreasing
is_increasing
is_strictly_decreasing
is_strictly_increasing
clamp
clamp_range
find_not
find_backward
find_not_backward
find_if_backward
find_if_not
find_if_not_backward
gather
hex
unhex
hex_lower
is_palindrome
is_partitioned_until
apply_reverse_permutation
apply_permutation
iota_n
power
尚未文档化的 C++17 算法
尚未文档化的其他算法
参考
头文件 <boost/algorithm/algorithm.hpp>
头文件 <boost/algorithm/apply_permutation.hpp>
头文件 <boost/algorithm/clamp.hpp>
头文件 <boost/algorithm/cxx11/all_of.hpp>
头文件 <boost/algorithm/cxx11/any_of.hpp>
头文件 <boost/algorithm/cxx11/copy_if.hpp>
头文件 <boost/algorithm/cxx11/copy_n.hpp>
头文件 <boost/algorithm/cxx11/find_if_not.hpp>
头文件 <boost/algorithm/cxx11/iota.hpp>
头文件 <boost/algorithm/cxx11/is_partitioned.hpp>
头文件 <boost/algorithm/cxx11/is_permutation.hpp>
头文件 <boost/algorithm/cxx14/is_permutation.hpp>
头文件 <boost/algorithm/cxx11/is_sorted.hpp>
头文件 <boost/algorithm/cxx11/none_of.hpp>
头文件 <boost/algorithm/cxx11/one_of.hpp>
头文件 <boost/algorithm/cxx11/partition_copy.hpp>
头文件 <boost/algorithm/cxx11/partition_point.hpp>
头文件 <boost/algorithm/cxx14/equal.hpp>
头文件 <boost/algorithm/cxx14/mismatch.hpp>
头文件 <boost/algorithm/cxx17/exclusive_scan.hpp>
头文件 <boost/algorithm/cxx17/for_each_n.hpp>
头文件 <boost/algorithm/cxx17/inclusive_scan.hpp>
头文件 <boost/algorithm/cxx17/reduce.hpp>
头文件 <boost/algorithm/cxx17/transform_exclusive_scan.hpp>
头文件 <boost/algorithm/cxx17/transform_inclusive_scan.hpp>
头文件 <boost/algorithm/cxx17/transform_reduce.hpp>
头文件 <boost/algorithm/find_backward.hpp>
头文件 <boost/algorithm/find_not.hpp>
头文件 <boost/algorithm/gather.hpp>
头文件 <boost/algorithm/hex.hpp>
头文件 <boost/algorithm/is_clamped.hpp>
头文件 <boost/algorithm/is_palindrome.hpp>
头文件 <boost/algorithm/is_partitioned_until.hpp>
头文件 <boost/algorithm/minmax.hpp>
头文件 <boost/algorithm/minmax_element.hpp>
头文件 <boost/algorithm/searching/boyer_moore.hpp>
头文件 <boost/algorithm/searching/boyer_moore_horspool.hpp>
头文件 <boost/algorithm/searching/knuth_morris_pratt.hpp>
头文件 <boost/algorithm/sort_subrange.hpp>
头文件 <boost/algorithm/string.hpp>
头文件 <boost/algorithm/string_regex.hpp>

Boost.Algorithm 是一个通用的算法集合。虽然 Boost 包含许多数据结构库,但缺少一个通用的算法库。尽管这些算法通常很有用,但许多算法被认为“太小”,不适合纳入 Boost。

例如,Boyer-Moore 搜索的实现可能需要开发者一周左右的时间来完成,包括测试用例和文档。然而,安排一次审查来将这些代码纳入 Boost 可能需要数月,并且会遇到阻力,因为它“太小了”。尽管如此,一个经过测试、审查、文档化的算法库可以极大地简化开发者的工作,这也是本库的目的。

未来计划

我将征集其他开发者的投稿,并查阅文献寻找现有算法以供包含。例如,Adobe Source Library 包含许多有用的算法,它们已经有了文档和测试用例。Knuth 的《计算机程序设计艺术》也充满了算法描述。

我的目标是定期进行算法审查,类似于 Boost 库的审查过程,但处理的代码块更小。

依赖项

Boost.Algorithm 使用 Boost.Range、Boost.Assert、Boost.Array、Boost.TypeTraits 和 Boost.StaticAssert。

致谢

感谢所有审查过本库并提出改进建议的人。特别是 Steven Watanabe 和 Sean Parent,他们提供了极大的帮助。


Next