1 [library The Boost Algorithm Library
5 [purpose Library of useful algorithms]
7 [authors [Clow, Marshall]]
8 [copyright 2010-2012 Marshall Clow]
11 Distributed under the Boost Software License, Version 1.0.
12 (See accompanying file LICENSE_1_0.txt or copy at
13 [@http://www.boost.org/LICENSE_1_0.txt])
17 [section Description and Rationale]
19 Boost.Algorithm is a collection of general purpose algorithms. While Boost contains many libraries of data structures, there is no single library for general purpose algorithms. Even though the algorithms are generally useful, many tend to be thought of as "too small" for Boost.
21 An implementation of Boyer-Moore searching, for example, might take a developer a week or so to implement, including test cases and documentation. However, scheduling a review to include that code into Boost might take several months, and run into resistance because "it is too small". Nevertheless, a library of tested, reviewed, documented algorithms can make the developer's life much easier, and that is the purpose of this library.
23 [heading Future plans]
25 I will be soliciting submissions from other developers, as well as looking through the literature for existing algorithms to include. The Adobe Source Library, for example, contains many useful algorithms that already have documentation and test cases. Knuth's _The Art of Computer Programming_ is chock-full of algorithm descriptions, too.
27 My goal is to run regular algorithm reviews, similar to the Boost library review process, but with smaller chunks of code.
29 [heading Dependencies]
31 Boost.Algorithm uses Boost.Range, Boost.Assert, Boost.Array, Boost.TypeTraits, and Boost.StaticAssert.
34 [heading Acknowledgements]
36 Thanks to all the people who have reviewed this library and made suggestions for improvements. Steven Watanabe and Sean Parent, in particular, have provided a great deal of help.
43 [section:Searching Searching Algorithms]
44 [include boyer_moore.qbk]
45 [include boyer_moore_horspool.qbk]
46 [include knuth_morris_pratt.qbk]
50 [section:CXX11 C++11 Algorithms]
52 [section:CXX11_inner_algorithms]
58 [include ordered-hpp.qbk]
59 [include is_partitioned.qbk]
60 [include is_permutation.qbk]
61 [include partition_point.qbk]
63 [section:partition_copy partition_copy ]
64 [*[^[link header.boost.algorithm.cxx11.partition_copy_hpp partition_copy] ] ]
65 Copy a subset of a sequence to a new sequence
66 [endsect:partition_copy]
68 [section:copy_if copy_if ]
69 [*[^[link header.boost.algorithm.cxx11.copy_if_hpp copy_if] ] ]
70 Copy a subset of a sequence to a new sequence
73 [section:copy_n copy_n ]
74 [*[^[link header.boost.algorithm.cxx11.copy_n_hpp copy_n] ] ]
75 Copy n items from one sequence to another
79 [*[^[link header.boost.algorithm.cxx11.iota_hpp iota] ] ]
80 Generate an increasing series
83 [endsect:CXX11_inner_algorithms]
88 [section:CXX14 C++14 Algorithms]
90 [section:CXX14_inner_algorithms]
93 [include mismatch.qbk]
95 [endsect:CXX14_inner_algorithms]
100 [section:CXX17 C++17 Algorithms]
102 [section:CXX17_inner_algorithms]
104 [section:for_each_n for_each_n]
105 [*[^[link boost.algorithm.for_each_n for_each_n] ] ]
106 Apply a functor to the elements of a sequence
109 [endsect:CXX17_inner_algorithms]
114 [section:Misc Other Algorithms]
116 [section:misc_inner_algorithms]
118 [section:none_of_equal none_of_equal ]
119 [*[^[link header.boost.algorithm.cxx11.none_of_hpp none_of_equal] ] ]
120 Whether none of a range's elements matches a value
121 [endsect:none_of_equal]
123 [section:one_of_equal one_of_equal ]
124 [*[^[link header.boost.algorithm.cxx11.one_of_hpp one_of_equal] ] ]
125 Whether only one of a range's elements matches a value
126 [endsect:one_of_equal]
128 [section:is_decreasing is_decreasing ]
129 [*[^[link header.boost.algorithm.cxx11.is_sorted_hpp is_decreasing] ] ]
130 Whether an entire sequence is decreasing; i.e, each item is less than or equal to the previous one
131 [endsect:is_decreasing]
133 [section:is_increasing is_increasing ]
134 [*[^[link header.boost.algorithm.cxx11.is_sorted_hpp is_increasing] ] ]
135 Whether an entire sequence is increasing; i.e, each item is greater than or equal to the previous one
136 [endsect:is_increasing]
138 [section:is_strictly_decreasing is_strictly_decreasing ]
139 [*[^[link header.boost.algorithm.cxx11.is_sorted_hpp is_strictly_decreasing] ] ]
140 Whether an entire sequence is strictly decreasing; i.e, each item is less than the previous one
141 [endsect:is_strictly_decreasing]
143 [section:is_strictly_increasing is_strictly_increasing ]
144 [*[^[link header.boost.algorithm.cxx11.is_sorted_hpp is_strictly_increasing] ] ]
145 Whether an entire sequence is strictly increasing; i.e, each item is greater than the previous one
146 [endsect:is_strictly_increasing]
148 [include clamp-hpp.qbk]
150 [section:clamp_range clamp_range ]
151 [*[^[link header.boost.algorithm.clamp_hpp clamp_range] ] ]
152 Perform [^clamp] on the elements of a range and write the results into an output iterator
153 [endsect:clamp_range]
155 [include find_not.qbk]
157 [include find_backward.qbk]
159 [section:find_not_backward find_not_backward ]
160 [*[^[link header.boost.algorithm.find_backward_hpp find_not_backward] ] ]
161 Find the last element in a sequence that does not equal a value.
162 See [link the_boost_algorithm_library.Misc.misc_inner_algorithms.find_backward find_backward].
163 [endsect:find_not_backward]
165 [section:find_if_backward find_if_backward ]
166 [*[^[link header.boost.algorithm.find_backward_hpp find_if_backward] ] ]
167 Find the last element in a sequence that satisfies a predicate.
168 See [link the_boost_algorithm_library.Misc.misc_inner_algorithms.find_backward find_backward].
169 [endsect:find_if_backward]
171 [section:find_if_not find_if_not ]
172 [*[^[link header.boost.algorithm.cxx11.find_if_not_hpp find_if_not] ] ]
173 Find the first element in a sequence that does not satisfy a predicate.
174 See [link the_boost_algorithm_library.Misc.misc_inner_algorithms.find_not find_not].
175 [endsect:find_if_not]
177 [section:find_if_not_backward find_if_not_backward ]
178 [*[^[link header.boost.algorithm.find_backward_hpp find_if_not_backward] ] ]
179 Find the last element in a sequence that does not satisfy a predicate.
180 See [link the_boost_algorithm_library.Misc.misc_inner_algorithms.find_backward find_backward].
181 [endsect:find_if_not_backward]
187 [section:unhex unhex ]
188 [*[^[link header.boost.algorithm.hex_hpp unhex] ] ]
189 Convert a sequence of hexadecimal characters into a sequence of integers or characters
192 [section:hex_lower hex_lower ]
193 [*[^[link header.boost.algorithm.hex_hpp hex_lower] ] ]
194 Convert a sequence of integral types into a lower case hexadecimal sequence of characters
197 [include is_palindrome.qbk]
199 [include is_partitioned_until.qbk]
201 [section:apply_reverse_permutation apply_reverse_permutation ]
203 [endsect:apply_reverse_permutation]
205 [include apply_permutation.qbk]
207 [section:copy_until copy_until ]
208 [*[^[link header.boost.algorithm.cxx11.copy_if_hpp copy_until] ] ]
209 Copy all the elements at the start of the input range that do not satisfy the predicate to the output range
212 [section:copy_while copy_while ]
213 [*[^[link header.boost.algorithm.cxx11.copy_if_hpp copy_while] ] ]
214 Copy all the elements at the start of the input range that satisfy the predicate to the output range
217 [section:iota_n iota_n ]
218 [*[^[link boost.algorithm.iota_n iota_n] ] ]
219 Write a sequence of n increasing values to an output iterator
222 [section:power power ]
223 [*[^[link header.boost.algorithm.algorithm_hpp power] ] ]
224 Raise a value to an integral power ([^constexpr] since C++14)
227 [endsect:misc_inner_algorithms]
232 [section:not_yet_documented_cxx17_algos Not-yet-documented C++17 Algorithms]
234 * [*[^[link header.boost.algorithm.cxx17.exclusive_scan_hpp exclusive_scan] ] ]
235 * [*[^[link header.boost.algorithm.cxx17.inclusive_scan_hpp inclusive_scan] ] ]
236 * [*[^[link header.boost.algorithm.cxx17.reduce_hpp reduce] ] ]
237 * [*[^[link header.boost.algorithm.cxx17.transform_exclusive_scan_hpp transform_exclusive_scan] ] ]
238 * [*[^[link header.boost.algorithm.cxx17.transform_inclusive_scan_hpp transform_inclusive_scan] ] ]
239 * [*[^[link header.boost.algorithm.cxx17.transform_reduce_hpp transform_reduce] ] ]
241 [endsect:not_yet_documented_cxx17_algos]
244 [section:not_yet_documented_other_algos Not-yet-documented Other Algorithms]
246 * [*[^[link header.boost.algorithm.minmax_hpp minmax] ] ]
247 * [*[^[link header.boost.algorithm.minmax_element_hpp first_max_element] ] ]
248 * [*[^[link header.boost.algorithm.minmax_element_hpp first_min_element] ] ]
249 * [*[^[link header.boost.algorithm.minmax_element_hpp first_min_first_max_element] ] ]
250 * [*[^[link header.boost.algorithm.minmax_element_hpp first_min_last_max_element] ] ]
251 * [*[^[link header.boost.algorithm.minmax_element_hpp last_max_element] ] ]
252 * [*[^[link header.boost.algorithm.minmax_element_hpp last_min_element] ] ]
253 * [*[^[link header.boost.algorithm.minmax_element_hpp last_min_first_max_element] ] ]
254 * [*[^[link header.boost.algorithm.minmax_element_hpp last_min_last_max_element] ] ]
255 * [*[^[link header.boost.algorithm.minmax_element_hpp minmax_element] ] ]
256 * [*[^[link header.boost.algorithm.sort_subrange_hpp partition_subrange] ] ]
257 * [*[^[link header.boost.algorithm.sort_subrange_hpp sort_subrange] ] ]
259 [endsect:not_yet_documented_other_algos]
262 [xinclude autodoc.xml]