Boost C++ 库

...世界上最受推崇和专业设计的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu, 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