forked from boostorg/algorithm
Compare commits
31 Commits
boost-1.69
...
boost-1.75
Author | SHA1 | Date | |
---|---|---|---|
8c26a50a12 | |||
1e098f39d4 | |||
e4c3628f4d | |||
49d284392c | |||
68100d9198 | |||
1634b819b3 | |||
4547b1a5fe | |||
130e4da8cb | |||
7975c764bb | |||
8710bbd4b6 | |||
cfb7c429f7 | |||
ed4033f0cc | |||
6d86fb3aaa | |||
ce81930319 | |||
8e23ffde9e | |||
a814721376 | |||
9ef3df0d0b | |||
9093abbda9 | |||
77bbc6ce43 | |||
0a57ec30a2 | |||
9477cd8be0 | |||
f39107f228 | |||
1cbe285841 | |||
b6c04d6dc5 | |||
bf2b49e57e | |||
01b0dd8648 | |||
6763d75683 | |||
435cc61af8 | |||
45baad2431 | |||
5408a17020 | |||
c6f784cb70 |
@ -16,17 +16,18 @@ using quickbook ;
|
||||
using doxygen ;
|
||||
using boostbook ;
|
||||
|
||||
doxygen autodoc
|
||||
:
|
||||
[ glob ../../../boost/algorithm/*.hpp
|
||||
doxygen autodoc
|
||||
:
|
||||
[ glob ../../../boost/algorithm/*.hpp
|
||||
../../../boost/algorithm/searching/*.hpp
|
||||
../../../boost/algorithm/cxx11/*.hpp
|
||||
../../../boost/algorithm/cxx14/*.hpp
|
||||
../../../boost/algorithm/cxx17/*.hpp
|
||||
]
|
||||
:
|
||||
:
|
||||
<doxygen:param>"PREDEFINED=\"BOOST_ALGORITHM_DOXYGEN=1\""
|
||||
<doxygen:param>WARNINGS=YES # Default NO, but useful to see warnings, especially in a logfile.
|
||||
;
|
||||
;
|
||||
|
||||
|
||||
xml algorithm : algorithm.qbk ;
|
||||
@ -35,13 +36,13 @@ boostbook standalone
|
||||
:
|
||||
algorithm
|
||||
:
|
||||
<dependency>autodoc
|
||||
<dependency>autodoc
|
||||
<xsl:param>boost.root=../../../..
|
||||
<xsl:param>"boost.doxygen.reftitle=Boost.Algorithms C++ Reference"
|
||||
<xsl:param>chapter.autolabel=0
|
||||
<xsl:param>chunk.section.depth=8
|
||||
<xsl:param>toc.section.depth=2
|
||||
<xsl:param>toc.max.depth=2
|
||||
<xsl:param>toc.section.depth=3
|
||||
<xsl:param>toc.max.depth=3
|
||||
<xsl:param>generate.section.toc.level=1
|
||||
;
|
||||
|
||||
|
@ -46,7 +46,11 @@ Thanks to all the people who have reviewed this library and made suggestions for
|
||||
[include knuth_morris_pratt.qbk]
|
||||
[endsect]
|
||||
|
||||
|
||||
[section:CXX11 C++11 Algorithms]
|
||||
|
||||
[section:CXX11_inner_algorithms]
|
||||
|
||||
[include all_of.qbk]
|
||||
[include any_of.qbk]
|
||||
[include none_of.qbk]
|
||||
@ -55,24 +59,204 @@ Thanks to all the people who have reviewed this library and made suggestions for
|
||||
[include is_partitioned.qbk]
|
||||
[include is_permutation.qbk]
|
||||
[include partition_point.qbk]
|
||||
[endsect]
|
||||
|
||||
[section:partition_copy partition_copy ]
|
||||
[*[^[link header.boost.algorithm.cxx11.partition_copy_hpp partition_copy] ] ]
|
||||
Copy a subset of a sequence to a new sequence
|
||||
[endsect:partition_copy]
|
||||
|
||||
[section:copy_if copy_if ]
|
||||
[*[^[link header.boost.algorithm.cxx11.copy_if_hpp copy_if] ] ]
|
||||
Copy a subset of a sequence to a new sequence
|
||||
[endsect:copy_if]
|
||||
|
||||
[section:copy_n copy_n ]
|
||||
[*[^[link header.boost.algorithm.cxx11.copy_n_hpp copy_n] ] ]
|
||||
Copy n items from one sequence to another
|
||||
[endsect:copy_n]
|
||||
|
||||
[section:iota iota ]
|
||||
[*[^[link header.boost.algorithm.cxx11.iota_hpp iota] ] ]
|
||||
Generate an increasing series
|
||||
[endsect:iota]
|
||||
|
||||
[endsect:CXX11_inner_algorithms]
|
||||
|
||||
[endsect:CXX11]
|
||||
|
||||
|
||||
[section:CXX14 C++14 Algorithms]
|
||||
|
||||
[section:CXX14_inner_algorithms]
|
||||
|
||||
[include equal.qbk]
|
||||
[include mismatch.qbk]
|
||||
[endsect]
|
||||
|
||||
[endsect:CXX14_inner_algorithms]
|
||||
|
||||
[endsect:CXX14]
|
||||
|
||||
|
||||
[section:CXX17 C++17 Algorithms]
|
||||
|
||||
[section:CXX17_inner_algorithms]
|
||||
|
||||
[section:for_each_n for_each_n]
|
||||
[*[^[link boost.algorithm.for_each_n for_each_n] ] ]
|
||||
Apply a functor to the elements of a sequence
|
||||
[endsect:for_each_n]
|
||||
|
||||
[endsect:CXX17_inner_algorithms]
|
||||
|
||||
[endsect:CXX17]
|
||||
|
||||
|
||||
[section:Misc Other Algorithms]
|
||||
[include clamp-hpp.qbk]
|
||||
[include find_not.qbk]
|
||||
[include find_backward.qbk]
|
||||
[include gather.qbk]
|
||||
[include hex.qbk]
|
||||
[include is_palindrome.qbk]
|
||||
[include is_partitioned_until.qbk]
|
||||
[include apply_permutation.qbk]
|
||||
[endsect]
|
||||
|
||||
[section:misc_inner_algorithms]
|
||||
|
||||
[section:none_of_equal none_of_equal ]
|
||||
[*[^[link header.boost.algorithm.cxx11.none_of_hpp none_of_equal] ] ]
|
||||
Whether none of a range's elements matches a value
|
||||
[endsect:none_of_equal]
|
||||
|
||||
[section:one_of_equal one_of_equal ]
|
||||
[*[^[link header.boost.algorithm.cxx11.one_of_hpp one_of_equal] ] ]
|
||||
Whether only one of a range's elements matches a value
|
||||
[endsect:one_of_equal]
|
||||
|
||||
[section:is_decreasing is_decreasing ]
|
||||
[*[^[link header.boost.algorithm.cxx11.is_sorted_hpp is_decreasing] ] ]
|
||||
Whether an entire sequence is decreasing; i.e, each item is less than or equal to the previous one
|
||||
[endsect:is_decreasing]
|
||||
|
||||
[section:is_increasing is_increasing ]
|
||||
[*[^[link header.boost.algorithm.cxx11.is_sorted_hpp is_increasing] ] ]
|
||||
Whether an entire sequence is increasing; i.e, each item is greater than or equal to the previous one
|
||||
[endsect:is_increasing]
|
||||
|
||||
[section:is_strictly_decreasing is_strictly_decreasing ]
|
||||
[*[^[link header.boost.algorithm.cxx11.is_sorted_hpp is_strictly_decreasing] ] ]
|
||||
Whether an entire sequence is strictly decreasing; i.e, each item is less than the previous one
|
||||
[endsect:is_strictly_decreasing]
|
||||
|
||||
[section:is_strictly_increasing is_strictly_increasing ]
|
||||
[*[^[link header.boost.algorithm.cxx11.is_sorted_hpp is_strictly_increasing] ] ]
|
||||
Whether an entire sequence is strictly increasing; i.e, each item is greater than the previous one
|
||||
[endsect:is_strictly_increasing]
|
||||
|
||||
[include clamp-hpp.qbk]
|
||||
|
||||
[section:clamp_range clamp_range ]
|
||||
[*[^[link header.boost.algorithm.clamp_hpp clamp_range] ] ]
|
||||
Perform [^clamp] on the elements of a range and write the results into an output iterator
|
||||
[endsect:clamp_range]
|
||||
|
||||
[include find_not.qbk]
|
||||
|
||||
[include find_backward.qbk]
|
||||
|
||||
[section:find_not_backward find_not_backward ]
|
||||
[*[^[link header.boost.algorithm.find_backward_hpp find_not_backward] ] ]
|
||||
Find the last element in a sequence that does not equal a value.
|
||||
See [link the_boost_algorithm_library.Misc.misc_inner_algorithms.find_backward find_backward].
|
||||
[endsect:find_not_backward]
|
||||
|
||||
[section:find_if_backward find_if_backward ]
|
||||
[*[^[link header.boost.algorithm.find_backward_hpp find_if_backward] ] ]
|
||||
Find the last element in a sequence that satisfies a predicate.
|
||||
See [link the_boost_algorithm_library.Misc.misc_inner_algorithms.find_backward find_backward].
|
||||
[endsect:find_if_backward]
|
||||
|
||||
[section:find_if_not find_if_not ]
|
||||
[*[^[link header.boost.algorithm.cxx11.find_if_not_hpp find_if_not] ] ]
|
||||
Find the first element in a sequence that does not satisfy a predicate.
|
||||
See [link the_boost_algorithm_library.Misc.misc_inner_algorithms.find_not find_not].
|
||||
[endsect:find_if_not]
|
||||
|
||||
[section:find_if_not_backward find_if_not_backward ]
|
||||
[*[^[link header.boost.algorithm.find_backward_hpp find_if_not_backward] ] ]
|
||||
Find the last element in a sequence that does not satisfy a predicate.
|
||||
See [link the_boost_algorithm_library.Misc.misc_inner_algorithms.find_backward find_backward].
|
||||
[endsect:find_if_not_backward]
|
||||
|
||||
[include gather.qbk]
|
||||
|
||||
[include hex.qbk]
|
||||
|
||||
[section:unhex unhex ]
|
||||
[*[^[link header.boost.algorithm.hex_hpp unhex] ] ]
|
||||
Convert a sequence of hexadecimal characters into a sequence of integers or characters
|
||||
[endsect:unhex]
|
||||
|
||||
[section:hex_lower hex_lower ]
|
||||
[*[^[link header.boost.algorithm.hex_hpp hex_lower] ] ]
|
||||
Convert a sequence of integral types into a lower case hexadecimal sequence of characters
|
||||
[endsect:hex_lower]
|
||||
|
||||
[include is_palindrome.qbk]
|
||||
|
||||
[include is_partitioned_until.qbk]
|
||||
|
||||
[section:apply_reverse_permutation apply_reverse_permutation ]
|
||||
See below
|
||||
[endsect:apply_reverse_permutation]
|
||||
|
||||
[include apply_permutation.qbk]
|
||||
|
||||
[section:copy_until copy_until ]
|
||||
[*[^[link header.boost.algorithm.cxx11.copy_if_hpp copy_until] ] ]
|
||||
Copy all the elements at the start of the input range that do not satisfy the predicate to the output range
|
||||
[endsect:copy_until]
|
||||
|
||||
[section:copy_while copy_while ]
|
||||
[*[^[link header.boost.algorithm.cxx11.copy_if_hpp copy_while] ] ]
|
||||
Copy all the elements at the start of the input range that satisfy the predicate to the output range
|
||||
[endsect:copy_while]
|
||||
|
||||
[section:iota_n iota_n ]
|
||||
[*[^[link boost.algorithm.iota_n iota_n] ] ]
|
||||
Write a sequence of n increasing values to an output iterator
|
||||
[endsect:iota_n]
|
||||
|
||||
[section:power power ]
|
||||
[*[^[link header.boost.algorithm.algorithm_hpp power] ] ]
|
||||
Raise a value to an integral power ([^constexpr] since C++14)
|
||||
[endsect:power]
|
||||
|
||||
[endsect:misc_inner_algorithms]
|
||||
|
||||
[endsect:Misc]
|
||||
|
||||
|
||||
[section:not_yet_documented_cxx17_algos Not-yet-documented C++17 Algorithms]
|
||||
|
||||
* [*[^[link header.boost.algorithm.cxx17.exclusive_scan_hpp exclusive_scan] ] ]
|
||||
* [*[^[link header.boost.algorithm.cxx17.inclusive_scan_hpp inclusive_scan] ] ]
|
||||
* [*[^[link header.boost.algorithm.cxx17.reduce_hpp reduce] ] ]
|
||||
* [*[^[link header.boost.algorithm.cxx17.transform_exclusive_scan_hpp transform_exclusive_scan] ] ]
|
||||
* [*[^[link header.boost.algorithm.cxx17.transform_inclusive_scan_hpp transform_inclusive_scan] ] ]
|
||||
* [*[^[link header.boost.algorithm.cxx17.transform_reduce_hpp transform_reduce] ] ]
|
||||
|
||||
[endsect:not_yet_documented_cxx17_algos]
|
||||
|
||||
|
||||
[section:not_yet_documented_other_algos Not-yet-documented Other Algorithms]
|
||||
|
||||
* [*[^[link header.boost.algorithm.minmax_hpp minmax] ] ]
|
||||
* [*[^[link header.boost.algorithm.minmax_element_hpp first_max_element] ] ]
|
||||
* [*[^[link header.boost.algorithm.minmax_element_hpp first_min_element] ] ]
|
||||
* [*[^[link header.boost.algorithm.minmax_element_hpp first_min_first_max_element] ] ]
|
||||
* [*[^[link header.boost.algorithm.minmax_element_hpp first_min_last_max_element] ] ]
|
||||
* [*[^[link header.boost.algorithm.minmax_element_hpp last_max_element] ] ]
|
||||
* [*[^[link header.boost.algorithm.minmax_element_hpp last_min_element] ] ]
|
||||
* [*[^[link header.boost.algorithm.minmax_element_hpp last_min_first_max_element] ] ]
|
||||
* [*[^[link header.boost.algorithm.minmax_element_hpp last_min_last_max_element] ] ]
|
||||
* [*[^[link header.boost.algorithm.minmax_element_hpp minmax_element] ] ]
|
||||
* [*[^[link header.boost.algorithm.sort_subrange_hpp partition_subrange] ] ]
|
||||
* [*[^[link header.boost.algorithm.sort_subrange_hpp sort_subrange] ] ]
|
||||
|
||||
[endsect:not_yet_documented_other_algos]
|
||||
|
||||
|
||||
[xinclude autodoc.xml]
|
||||
|
@ -9,7 +9,7 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
]
|
||||
|
||||
The header file 'apply_permutation.hpp' contains two algorithms, apply_permutation and apply_reverse_permutation. Also there are range-based versions.
|
||||
The header file [^[link header.boost.algorithm.apply_permutation_hpp apply_permutation.hpp]] contains two algorithms, `apply_permutation` and `apply_reverse_permutation`. There are also range-based versions.
|
||||
The algorithms transform the item sequence according to index sequence order.
|
||||
|
||||
The routine `apply_permutation` takes a item sequence and a order sequence. It reshuffles item sequence according to order sequence. Every value in order sequence means where the item comes from. Order sequence needs to be exactly a permutation of the sequence [0, 1, ... , N], where N is the biggest index in the item sequence (zero-indexed).
|
||||
|
@ -28,7 +28,7 @@ the use of `std::find()`:
|
||||
|
||||
auto rfirst = std::make_reverse_iterator(last);
|
||||
auto rlast = std::make_reverse_iterator(first);
|
||||
auto it = std::find(rfirst, rlast);
|
||||
auto it = std::find(rfirst, rlast, x);
|
||||
// Use it here...
|
||||
|
||||
That seems nicer in that there is no raw loop, but it has two major drawbacks.
|
||||
|
@ -15,19 +15,19 @@ equal to the given value.
|
||||
|
||||
Consider this use of `find()`:
|
||||
|
||||
auto std::vector<int> vec = { 1, 1, 2 };
|
||||
std::vector<int> vec = { 1, 1, 2 };
|
||||
auto it = std::find(vec.begin(), vec.end(), 1);
|
||||
|
||||
This gives us the first occurance of `1` in `vec`. What if we want to find
|
||||
the first occurrance of any number besides `1` in `vec`? We have to write an
|
||||
unfortunate amount of code:
|
||||
|
||||
auto std::vector<int> vec = { 1, 1, 2 };
|
||||
std::vector<int> vec = { 1, 1, 2 };
|
||||
auto it = std::find_if(vec.begin(), vec.end(), [](int i) { return i != 1; });
|
||||
|
||||
With `find_not()` the code gets much more terse:
|
||||
|
||||
auto std::vector<int> vec = { 1, 1, 2 };
|
||||
std::vector<int> vec = { 1, 1, 2 };
|
||||
auto it = find_not(vec.begin(), vec.end(), 1);
|
||||
|
||||
The existing `find` variants are: `find()`, `find_if()`, and `find_if_not()`.
|
||||
|
@ -15,7 +15,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
The header file `<boost/algorithm/cxx11/is_sorted.hpp>` contains functions for determining if a sequence is ordered.
|
||||
|
||||
[heading is_sorted]
|
||||
The function `is_sorted(sequence)` determines whether or not a sequence is completely sorted according so some criteria. If no comparison predicate is specified, then std::less_equal is used (i.e, the test is to see if the sequence is non-decreasing)
|
||||
The function `is_sorted(sequence)` determines whether or not a sequence is completely sorted according so some criteria. If no comparison predicate is specified, then `std::less` is used (i.e, the test is to see if the sequence is non-decreasing)
|
||||
|
||||
``
|
||||
namespace boost { namespace algorithm {
|
||||
|
@ -18,8 +18,8 @@ project /boost/algorithm/example
|
||||
:
|
||||
;
|
||||
|
||||
exe clamp_example : clamp_example.cpp ;
|
||||
exe clamp_example : clamp_example.cpp : ;
|
||||
exe search_example : search_example.cpp ;
|
||||
exe is_palindrome_example : is_palindrome_example.cpp;
|
||||
exe is_partitioned_until_example : is_partitioned_until_example.cpp;
|
||||
exe apply_permutation_example : apply_permutation_example.cpp;
|
||||
exe is_palindrome_example : is_palindrome_example.cpp : <cxxstd>11 ;
|
||||
exe is_partitioned_until_example : is_partitioned_until_example.cpp : <cxxstd>11 ;
|
||||
exe apply_permutation_example : apply_permutation_example.cpp : <cxxstd>11 ;
|
||||
|
@ -32,8 +32,8 @@ struct isOddComp
|
||||
|
||||
int main ( int /*argc*/, char * /*argv*/ [] )
|
||||
{
|
||||
std::vector<int> good({1, 2, 4});
|
||||
std::vector<int> bad({1, 2, 3});
|
||||
std::vector<int> good{1, 2, 4};
|
||||
std::vector<int> bad{1, 2, 3};
|
||||
|
||||
//Use custom function
|
||||
auto it1 = ba::is_partitioned_until(good.begin(), good.end(), isOdd);
|
||||
|
@ -27,7 +27,7 @@ int main ( int /*argc*/, char * /*argv*/ [] ) {
|
||||
// algorithms. They all have the same (dual) interface.
|
||||
|
||||
// There is a procedural interface, based on std::search:
|
||||
if ( ba::boyer_moore_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != haystack.end ())
|
||||
if ( ba::boyer_moore_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != std::make_pair(haystack.end(), haystack.end()))
|
||||
std::cout << "Found '" << needle1 << "' in '" << haystack << "' (boyer-moore 1)" << std::endl;
|
||||
else
|
||||
std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (boyer-moore 1)" << std::endl;
|
||||
@ -36,19 +36,19 @@ int main ( int /*argc*/, char * /*argv*/ [] ) {
|
||||
// you can create a search object and use that over and over again - amortizing the setup
|
||||
// costs across several searches
|
||||
ba::boyer_moore<std::string::const_iterator> search1 ( needle1.begin (), needle1.end ());
|
||||
if ( search1 ( haystack.begin (), haystack.end ()) != haystack.end ())
|
||||
if ( search1 ( haystack.begin (), haystack.end ()) != std::make_pair(haystack.end(), haystack.end()))
|
||||
std::cout << "Found '" << needle1 << "' in '" << haystack << "' (boyer-moore 2)" << std::endl;
|
||||
else
|
||||
std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (boyer-moore 2)" << std::endl;
|
||||
|
||||
// There is also an implementation of boyer-moore-horspool searching
|
||||
if ( ba::boyer_moore_horspool_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != haystack.end ())
|
||||
if ( ba::boyer_moore_horspool_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != std::make_pair(haystack.end(), haystack.end()))
|
||||
std::cout << "Found '" << needle1 << "' in '" << haystack << "' (boyer-moore-horspool)" << std::endl;
|
||||
else
|
||||
std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (boyer-moore-horspool)" << std::endl;
|
||||
|
||||
// And also the knuth-pratt-morris search algorithm
|
||||
if ( ba::knuth_morris_pratt_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != haystack.end ())
|
||||
if ( ba::knuth_morris_pratt_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != std::make_pair(haystack.end(), haystack.end()))
|
||||
std::cout << "Found '" << needle1 << "' in '" << haystack << "' (knuth_morris_pratt)" << std::endl;
|
||||
else
|
||||
std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (knuth_morris_pratt)" << std::endl;
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <functional> // for plus and multiplies
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/utility/enable_if.hpp> // for boost::disable_if
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
@ -41,15 +42,16 @@ void
|
||||
apply_permutation(RandomAccessIterator1 item_begin, RandomAccessIterator1 item_end,
|
||||
RandomAccessIterator2 ind_begin, RandomAccessIterator2 ind_end)
|
||||
{
|
||||
using Diff = typename std::iterator_traits<RandomAccessIterator1>::difference_type;
|
||||
typedef typename std::iterator_traits<RandomAccessIterator1>::difference_type Diff;
|
||||
typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type Index;
|
||||
using std::swap;
|
||||
Diff size = std::distance(item_begin, item_end);
|
||||
for (Diff i = 0; i < size; i++)
|
||||
{
|
||||
auto current = i;
|
||||
Diff current = i;
|
||||
while (i != ind_begin[current])
|
||||
{
|
||||
auto next = ind_begin[current];
|
||||
Index next = ind_begin[current];
|
||||
swap(item_begin[current], item_begin[next]);
|
||||
ind_begin[current] = current;
|
||||
current = next;
|
||||
@ -75,7 +77,7 @@ apply_reverse_permutation(
|
||||
RandomAccessIterator2 ind_begin,
|
||||
RandomAccessIterator2 ind_end)
|
||||
{
|
||||
using Diff = typename std::iterator_traits<RandomAccessIterator2>::difference_type;
|
||||
typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type Diff;
|
||||
using std::swap;
|
||||
Diff length = std::distance(item_begin, item_end);
|
||||
for (Diff i = 0; i < length; i++)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <iterator> // For std::iterator_traits
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/mpl/identity.hpp> // for identity
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef BOOST_ALGORITHM_ALL_OF_HPP
|
||||
#define BOOST_ALGORITHM_ALL_OF_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#ifndef BOOST_ALGORITHM_ANY_OF_HPP
|
||||
#define BOOST_ALGORITHM_ANY_OF_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
#define BOOST_ALGORITHM_COPY_IF_HPP
|
||||
|
||||
#include <utility> // for std::pair, std::make_pair
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#ifndef BOOST_ALGORITHM_COPY_N_HPP
|
||||
#define BOOST_ALGORITHM_COPY_N_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
/// \fn copy_n ( InputIterator first, Size n, OutputIterator result )
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP
|
||||
#define BOOST_ALGORITHM_FIND_IF_NOT_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef BOOST_ALGORITHM_IOTA_HPP
|
||||
#define BOOST_ALGORITHM_IOTA_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef BOOST_ALGORITHM_IS_PARTITIONED_HPP
|
||||
#define BOOST_ALGORITHM_IS_PARTITIONED_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <functional> // for std::equal_to
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef BOOST_ALGORITHM_NONE_OF_HPP
|
||||
#define BOOST_ALGORITHM_NONE_OF_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -12,11 +12,13 @@
|
||||
#ifndef BOOST_ALGORITHM_ONE_OF_HPP
|
||||
#define BOOST_ALGORITHM_ONE_OF_HPP
|
||||
|
||||
#include <boost/algorithm/cxx11/none_of.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
#include <boost/algorithm/cxx11/none_of.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
/// \fn one_of ( InputIterator first, InputIterator last, Predicate p )
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include <iterator> // for std::distance, advance
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
namespace detail {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <functional> // for std::equal_to
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/algorithm/cxx11/is_permutation.hpp>
|
||||
#include <boost/algorithm/cxx14/mismatch.hpp>
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#define BOOST_ALGORITHM_MISMATCH_HPP
|
||||
|
||||
#include <utility> // for std::pair
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <functional> // for std::plus
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#include <utility> // for std::pair
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
/// \fn for_each_n(InputIterator first, Size n, Function f);
|
||||
|
@ -9,12 +9,13 @@
|
||||
/// \brief Combine the (transformed) elements of a sequence (or two) into a single value.
|
||||
/// \author Marshall Clow
|
||||
|
||||
#ifndef BOOST_ALGORITHM_TRANSFORM_REDUCE_HPP
|
||||
#define BOOST_ALGORITHM_TRANSFORM_REDUCE_HPP
|
||||
#ifndef BOOST_ALGORITHM_INCLUSIVE_SCAN_HPP
|
||||
#define BOOST_ALGORITHM_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <functional> // for std::plus
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
@ -57,4 +58,4 @@ OutputIterator inclusive_scan(InputIterator first, InputIterator last,
|
||||
|
||||
}} // namespace boost and algorithm
|
||||
|
||||
#endif // BOOST_ALGORITHM_TRANSFORM_REDUCE_HPP
|
||||
#endif // BOOST_ALGORITHM_INCLUSIVE_SCAN_HPP
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <functional> // for std::plus
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <functional> // for std::plus
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <functional> // for std::plus
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <functional> // for std::plus
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
@ -2,18 +2,17 @@
|
||||
Copyright (c) T. Zachary Laine 2018.
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE10.txt or copy at http://www.boost.org/LICENSE10.txt)
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALGORITHM_FIND_BACKWARD_HPP
|
||||
#define BOOST_ALGORITHM_FIND_BACKWARD_HPP
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
template<typename BidiIter, typename T>
|
||||
|
@ -2,18 +2,17 @@
|
||||
Copyright (c) T. Zachary Laine 2018.
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE10.txt or copy at http://www.boost.org/LICENSE10.txt)
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALGORITHM_FIND_NOT_HPP
|
||||
#define BOOST_ALGORITHM_FIND_NOT_HPP
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
template<typename InputIter, typename Sentinel, typename T>
|
||||
|
@ -22,8 +22,10 @@
|
||||
|
||||
#include <algorithm> // for std::stable_partition
|
||||
#include <functional>
|
||||
#include <utility> // for std::make_pair
|
||||
|
||||
#include <boost/bind.hpp> // for boost::bind
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/bind/bind.hpp> // for boost::bind
|
||||
#include <boost/range/begin.hpp> // for boost::begin(range)
|
||||
#include <boost/range/end.hpp> // for boost::end(range)
|
||||
|
||||
@ -80,13 +82,14 @@ namespace boost { namespace algorithm {
|
||||
*/
|
||||
|
||||
template <
|
||||
typename BidirectionalIterator, // Iter models BidirectionalIterator
|
||||
typename Pred> // Pred models UnaryPredicate
|
||||
typename BidirectionalIterator, // models BidirectionalIterator
|
||||
typename Pred> // models UnaryPredicate
|
||||
std::pair<BidirectionalIterator, BidirectionalIterator> gather
|
||||
( BidirectionalIterator first, BidirectionalIterator last, BidirectionalIterator pivot, Pred pred )
|
||||
{
|
||||
// The first call partitions everything up to (but not including) the pivot element,
|
||||
// while the second call partitions the rest of the sequence.
|
||||
using namespace boost::placeholders;
|
||||
return std::make_pair (
|
||||
std::stable_partition ( first, pivot, !boost::bind<bool> ( pred, _1 )),
|
||||
std::stable_partition ( pivot, last, boost::bind<bool> ( pred, _1 )));
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <iterator> // for std::iterator_traits
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <functional>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef BOOST_ALGORITHM_IS_PARTITIONED_UNTIL_HPP
|
||||
#define BOOST_ALGORITHM_IS_PARTITIONED_UNTIL_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/tuple/tuple.hpp> // for using pairs with boost::cref
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#include <utility> // for std::pair and std::make_pair
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail { // for obtaining a uniform version of minmax_element
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <iterator> // For std::iterator_traits
|
||||
#include <algorithm> // For nth_element and partial_sort
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace boost {
|
||||
template< typename T1, typename T2 >
|
||||
bool operator()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper(Arg1)==std::toupper(Arg2);
|
||||
#else
|
||||
return std::toupper<T1>(Arg1,m_Loc)==std::toupper<T2>(Arg2,m_Loc);
|
||||
@ -118,7 +118,7 @@ namespace boost {
|
||||
template< typename T1, typename T2 >
|
||||
bool operator()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper(Arg1)<std::toupper(Arg2);
|
||||
#else
|
||||
return std::toupper<T1>(Arg1,m_Loc)<std::toupper<T2>(Arg2,m_Loc);
|
||||
@ -171,7 +171,7 @@ namespace boost {
|
||||
template< typename T1, typename T2 >
|
||||
bool operator()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper(Arg1)<=std::toupper(Arg2);
|
||||
#else
|
||||
return std::toupper<T1>(Arg1,m_Loc)<=std::toupper<T2>(Arg2,m_Loc);
|
||||
|
@ -15,6 +15,9 @@
|
||||
#include <locale>
|
||||
#include <functional>
|
||||
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
|
||||
namespace boost {
|
||||
@ -40,7 +43,7 @@ namespace boost {
|
||||
// Operation
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::tolower( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
|
||||
#else
|
||||
return std::tolower<CharT>( Ch, *m_Loc );
|
||||
@ -62,7 +65,7 @@ namespace boost {
|
||||
// Operation
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
|
||||
#else
|
||||
return std::toupper<CharT>( Ch, *m_Loc );
|
||||
|
@ -13,10 +13,12 @@
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <locale>
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/distance.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
#include <boost/algorithm/string/predicate_facade.hpp>
|
||||
@ -45,7 +47,7 @@ namespace boost {
|
||||
return std::use_facet< std::ctype<CharT> >(m_Locale).is( m_Type, Ch );
|
||||
}
|
||||
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x582) && !defined(_USE_OLD_RW_STL)
|
||||
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x582) && !defined(_USE_OLD_RW_STL)
|
||||
template<>
|
||||
bool operator()( char const Ch ) const
|
||||
{
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <boost/algorithm/string/detail/find_format_store.hpp>
|
||||
#include <boost/algorithm/string/detail/replace_storage.hpp>
|
||||
|
||||
#include <deque>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/algorithm/string/constants.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
@ -127,8 +127,8 @@ namespace boost {
|
||||
if( boost::empty(m_Search) )
|
||||
return result_type( End, End );
|
||||
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
std::iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
|
||||
return findit( Begin, End, category() );
|
||||
}
|
||||
@ -344,9 +344,8 @@ namespace boost {
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
input_iterator_type It=Begin;
|
||||
for(
|
||||
unsigned int Index=0;
|
||||
Index<N && It!=End; ++Index,++It ) {};
|
||||
for( unsigned int Index=0; Index<N && It!=End; ++Index,++It )
|
||||
;
|
||||
|
||||
return result_type( Begin, It );
|
||||
}
|
||||
@ -375,8 +374,8 @@ namespace boost {
|
||||
ForwardIteratorT End,
|
||||
unsigned int N )
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
std::iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
|
||||
return ::boost::algorithm::detail::find_head_impl( Begin, End, N, category() );
|
||||
}
|
||||
@ -397,10 +396,12 @@ namespace boost {
|
||||
input_iterator_type It2=Begin;
|
||||
|
||||
// Advance It2 by N increments
|
||||
for( Index=0; Index<N && It2!=End; ++Index,++It2 ) {};
|
||||
for( Index=0; Index<N && It2!=End; ++Index,++It2 )
|
||||
;
|
||||
|
||||
// Advance It, It2 to the end
|
||||
for(; It2!=End; ++It,++It2 ) {};
|
||||
for(; It2!=End; ++It,++It2 )
|
||||
;
|
||||
|
||||
return result_type( It, It2 );
|
||||
}
|
||||
@ -417,9 +418,8 @@ namespace boost {
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
input_iterator_type It=End;
|
||||
for(
|
||||
unsigned int Index=0;
|
||||
Index<N && It!=Begin; ++Index,--It ) {};
|
||||
for( unsigned int Index=0; Index<N && It!=Begin; ++Index,--It )
|
||||
;
|
||||
|
||||
return result_type( It, End );
|
||||
}
|
||||
@ -448,8 +448,8 @@ namespace boost {
|
||||
ForwardIteratorT End,
|
||||
unsigned int N )
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
std::iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
|
||||
return ::boost::algorithm::detail::find_tail_impl( Begin, End, N, category() );
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace boost {
|
||||
m_Format(::boost::begin(Format), ::boost::end(Format)) {}
|
||||
|
||||
// Operation
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
template<typename Range2T>
|
||||
result_type& operator()(const Range2T&)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define BOOST_STRING_TRIM_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
@ -80,8 +80,8 @@ namespace boost {
|
||||
ForwardIteratorT InEnd,
|
||||
PredicateT IsSpace )
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
std::iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
|
||||
return ::boost::algorithm::detail::trim_end_iter_select( InBegin, InEnd, IsSpace, category() );
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#define BOOST_STRING_FIND_FORMAT_HPP
|
||||
|
||||
#include <deque>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
@ -40,7 +39,7 @@ namespace boost {
|
||||
this substring and replace it in the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input sequence
|
||||
\param Finder A Finder object used to search for a match to be replaced
|
||||
|
@ -11,7 +11,6 @@
|
||||
#ifndef BOOST_STRING_FORMATTER_HPP
|
||||
#define BOOST_STRING_FORMATTER_HPP
|
||||
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/as_literal.hpp>
|
||||
|
@ -71,7 +71,11 @@ namespace boost {
|
||||
inline SequenceSequenceT&
|
||||
iter_find(
|
||||
SequenceSequenceT& Result,
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
RangeT&& Input,
|
||||
#else
|
||||
RangeT& Input,
|
||||
#endif
|
||||
FinderT Finder )
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
@ -142,7 +146,11 @@ namespace boost {
|
||||
inline SequenceSequenceT&
|
||||
iter_split(
|
||||
SequenceSequenceT& Result,
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
RangeT&& Input,
|
||||
#else
|
||||
RangeT& Input,
|
||||
#endif
|
||||
FinderT Finder )
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
|
@ -11,6 +11,7 @@
|
||||
#ifndef BOOST_STRING_PREDICATE_HPP
|
||||
#define BOOST_STRING_PREDICATE_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
@ -144,10 +145,10 @@ namespace boost {
|
||||
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(::boost::as_literal(Input));
|
||||
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(::boost::as_literal(Test));
|
||||
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<Range1T>::type Iterator1T;
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<Iterator1T>::iterator_category category;
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
std::iterator_traits<Iterator1T>::iterator_category category;
|
||||
|
||||
return detail::
|
||||
ends_with_iter_select(
|
||||
|
@ -61,7 +61,11 @@ namespace boost {
|
||||
template< typename SequenceSequenceT, typename Range1T, typename Range2T >
|
||||
inline SequenceSequenceT& find_all(
|
||||
SequenceSequenceT& Result,
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
Range1T&& Input,
|
||||
#else
|
||||
Range1T& Input,
|
||||
#endif
|
||||
const Range2T& Search)
|
||||
{
|
||||
return ::boost::algorithm::iter_find(
|
||||
@ -96,7 +100,11 @@ namespace boost {
|
||||
template< typename SequenceSequenceT, typename Range1T, typename Range2T >
|
||||
inline SequenceSequenceT& ifind_all(
|
||||
SequenceSequenceT& Result,
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
Range1T&& Input,
|
||||
#else
|
||||
Range1T& Input,
|
||||
#endif
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
@ -139,7 +147,11 @@ namespace boost {
|
||||
template< typename SequenceSequenceT, typename RangeT, typename PredicateT >
|
||||
inline SequenceSequenceT& split(
|
||||
SequenceSequenceT& Result,
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
RangeT&& Input,
|
||||
#else
|
||||
RangeT& Input,
|
||||
#endif
|
||||
PredicateT Pred,
|
||||
token_compress_mode_type eCompress=token_compress_off )
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace boost {
|
||||
tuple<T const&, T const&> >
|
||||
minmax(const T& a, const T& b);
|
||||
|
||||
template <class T, class <a href="http://www.sgi.com/tech/stl/ BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class T, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
tuple<T const&, T const&> >
|
||||
minmax(const T& a, const T& b, BinaryPredicate comp);
|
||||
|
||||
@ -38,77 +38,77 @@ Synopsis of <tt><boost/algorithm/minmax_element.hpp></tt></h3>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
minmax_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
minmax_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
|
||||
// Variants
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
ForwardIterator first_min_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
ForwardIterator first_min_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
ForwardIterator last_min_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
ForwardIterator last_min_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
ForwardIterator first_max_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
ForwardIterator first_max_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
ForwardIterator last_max_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
ForwardIterator last_max_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
first_min_first_max_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
first_min_first_max_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
first_min_last_max_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
first_min_last_max_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
last_min_first_max_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
last_min_first_max_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
last_min_last_max_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
last_min_last_max_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
|
@ -95,7 +95,7 @@ namespace boost {
|
||||
tuple<T const&, T const&>
|
||||
minmax(const T& a, const T& b);
|
||||
|
||||
template <class T, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class T, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
tuple<T const&, T const&>
|
||||
minmax(const T& a, const T& b, BinaryPredicate comp);
|
||||
|
||||
@ -109,11 +109,11 @@ Synopsis of <tt><boost/algorithm/minmax_element.hpp></tt></h3>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
minmax_element(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
template <class <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
template <class <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>, class <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||
std::pair<ForwardIterator,ForwardIterator>
|
||||
minmax_element(ForwardIterator first, ForwardIterator last,
|
||||
BinaryPredicate comp);
|
||||
@ -190,26 +190,26 @@ in <a href="../../../boost/algorithm/minmax_element.hpp">minmax_element.hpp</a>.
|
||||
<a name="reqs">
|
||||
<h3>
|
||||
Requirements on types</h3>
|
||||
For minmax, <tt>T</tt> must be a model of <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan
|
||||
For minmax, <tt>T</tt> must be a model of <a href="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThan
|
||||
Comparable</a>.
|
||||
<p>For all the other function templates, versions with two template parameters:
|
||||
<ul>
|
||||
<li>
|
||||
<tt>ForwardIterator</tt> is a model of <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">Forward
|
||||
<tt>ForwardIterator</tt> is a model of <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">Forward
|
||||
Iterator</a>.</li>
|
||||
|
||||
<li>
|
||||
<tt>ForwardIterator</tt>'s value type is <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan
|
||||
<tt>ForwardIterator</tt>'s value type is <a href="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThan
|
||||
Comparable</a>.</li>
|
||||
</ul>
|
||||
For the versions with three template parameters:
|
||||
<ul>
|
||||
<li>
|
||||
<tt>ForwardIterator</tt> is a model of <a href="http://www.sgi.com/tech/stl/ForwardIterator.html">Forward
|
||||
<tt>ForwardIterator</tt> is a model of <a href="https://www.boost.org/sgi/stl/ForwardIterator.html">Forward
|
||||
Iterator</a>.</li>
|
||||
|
||||
<li>
|
||||
<tt>BinaryPredicate</tt> is a model of <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">Binary
|
||||
<tt>BinaryPredicate</tt> is a model of <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html">Binary
|
||||
Predicate</a>.</li>
|
||||
|
||||
<li>
|
||||
@ -285,8 +285,8 @@ the library under
|
||||
assert( result1.get<0>() == 0 );
|
||||
assert( result1.get<1>() == 1 );
|
||||
|
||||
<a href="http://www.sgi.com/tech/stl/List.html">list</a><int> L;
|
||||
<a href="http://www.sgi.com/tech/stl/generate_n.html">generate_n</a>(<a href="http://www.sgi.com/tech/stl/front_insert_iterator.html">front_inserter</a>(L), 1000, rand);
|
||||
<a href="https://www.boost.org/sgi/stl/List.html">list</a><int> L;
|
||||
<a href="https://www.boost.org/sgi/stl/generate_n.html">generate_n</a>(<a href="https://www.boost.org/sgi/stl/front_insert_iterator.html">front_inserter</a>(L), 1000, rand);
|
||||
|
||||
typedef list<int>::const_iterator iterator;
|
||||
pair< iterator, iterator > result2 = boost::minmax_element(L.begin(), L.end());
|
||||
@ -512,13 +512,13 @@ release, Eric Niebler noted the bad behavior of <tt>std::pair</tt> for
|
||||
All my thanks for the excellent advice and reviews from all.
|
||||
<h3>
|
||||
See also</h3>
|
||||
<tt><a href="http://www.sgi.com/tech/stl/min.html">min</a></tt>, <tt><a href="http://www.sgi.com/tech/stl/max.html">max</a></tt>,
|
||||
<tt><a href="http://www.sgi.com/tech/stl/min_element.html">min_element</a></tt>,
|
||||
<tt><a href="http://www.sgi.com/tech/stl/max_element.html">max_element</a></tt>,
|
||||
<tt><a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan
|
||||
<tt><a href="https://www.boost.org/sgi/stl/min.html">min</a></tt>, <tt><a href="https://www.boost.org/sgi/stl/max.html">max</a></tt>,
|
||||
<tt><a href="https://www.boost.org/sgi/stl/min_element.html">min_element</a></tt>,
|
||||
<tt><a href="https://www.boost.org/sgi/stl/max_element.html">max_element</a></tt>,
|
||||
<tt><a href="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThan
|
||||
Comparable</a></tt>,
|
||||
<tt><a href="http://www.sgi.com/tech/stl/sort.html">sort</a></tt>,
|
||||
<tt><a href="http://www.sgi.com/tech/stl/nth_element.html">nth_element</a></tt>
|
||||
<tt><a href="https://www.boost.org/sgi/stl/sort.html">sort</a></tt>,
|
||||
<tt><a href="https://www.boost.org/sgi/stl/nth_element.html">nth_element</a></tt>
|
||||
.
|
||||
<hr SIZE="6">
|
||||
<br>Last modified 2012-12-10
|
||||
|
@ -15,7 +15,7 @@ alias unit_test_framework
|
||||
;
|
||||
|
||||
{
|
||||
test-suite algorithm/minmax:
|
||||
test-suite algorithm/minmax
|
||||
: [ run minmax_element_test.cpp unit_test_framework
|
||||
: : : : minmax_element ]
|
||||
[ run minmax_test.cpp unit_test_framework
|
||||
|
@ -31,7 +31,7 @@
|
||||
typedef <i>implementation defined </i> foo_type;</code><p >The corresponding external concept is the ExternalFooConcept.</p><p >A type <code>T</code> fullfills the ExternalFooConcept if these
|
||||
free-standing functions and type-generators exists:</p><code>void foo( const T&, int ); <br>
|
||||
int bar( T& ); <br>
|
||||
foo_type_of< T >::type;</code> <br> <br><hr size="1" ><h3 >Literature</h3><ul ><li > <a href="http://www.boost.org/more/generic_programming.html#type_generator" target="_self" >Type Generators</a> </li><li > <a href="http://www.boost.org/more/generic_programming.html#concept" target="_self" >Concepts</a> </li><li > <a href="http://www.sgi.com/tech/stl/stl_introduction.html" target="_self" >Concepts and SGI STL</a> </li></ul><hr size="1" ><p >© Thorsten Ottosen 2003-2004 (nesotto_AT_cs.auc.dk).
|
||||
foo_type_of< T >::type;</code> <br> <br><hr size="1" ><h3 >Literature</h3><ul ><li > <a href="http://www.boost.org/more/generic_programming.html#type_generator" target="_self" >Type Generators</a> </li><li > <a href="http://www.boost.org/more/generic_programming.html#concept" target="_self" >Concepts</a> </li><li > <a href="https://www.boost.org/sgi/stl/stl_introduction.html" target="_self" >Concepts and SGI STL</a> </li></ul><hr size="1" ><p >© Thorsten Ottosen 2003-2004 (nesotto_AT_cs.auc.dk).
|
||||
<br>Use, modification and distribution is subject to the Boost
|
||||
Software License, Version 1.0. (See accompanying file
|
||||
<code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include <functional>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/algorithm/string/find_format.hpp>
|
||||
#include <boost/algorithm/string/finder.hpp>
|
||||
|
||||
@ -46,7 +46,7 @@ struct find_compressF
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
typedef typename boost::detail::iterator_traits<input_iterator_type>::value_type value_type;
|
||||
typedef typename std::iterator_traits<input_iterator_type>::value_type value_type;
|
||||
typedef iterator_range<input_iterator_type> result_type;
|
||||
|
||||
// begin of the matching segment
|
||||
@ -144,7 +144,7 @@ struct find_decompressF
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
typedef typename boost::detail::iterator_traits<input_iterator_type>::value_type value_type;
|
||||
typedef typename std::iterator_traits<input_iterator_type>::value_type value_type;
|
||||
typedef iterator_range<input_iterator_type> result_type;
|
||||
|
||||
for(input_iterator_type It=Begin; It!=End; It++)
|
||||
@ -153,12 +153,12 @@ struct find_decompressF
|
||||
{
|
||||
// Repeat mark found, extract body
|
||||
input_iterator_type It2=It++;
|
||||
|
||||
|
||||
if ( It==End ) break;
|
||||
It++;
|
||||
if ( It==End ) break;
|
||||
It++;
|
||||
|
||||
|
||||
return result_type( It2, It );
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
// equals predicate is used for result comparison
|
||||
@ -82,6 +84,28 @@ void iterator_test()
|
||||
string("xx") );
|
||||
deep_compare( tokens, vtokens );
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
// If using a compiler that supports forwarding references, we should be able to use rvalues, too
|
||||
find_all(
|
||||
tokens,
|
||||
string("xx-abc--xx-abb"),
|
||||
"xx" );
|
||||
|
||||
BOOST_REQUIRE( tokens.size()==2 );
|
||||
BOOST_CHECK( tokens[0]==string("xx") );
|
||||
BOOST_CHECK( tokens[1]==string("xx") );
|
||||
|
||||
ifind_all(
|
||||
tokens,
|
||||
string("Xx-abc--xX-abb-xx"),
|
||||
"xx" );
|
||||
|
||||
BOOST_REQUIRE( tokens.size()==3 );
|
||||
BOOST_CHECK( tokens[0]==string("Xx") );
|
||||
BOOST_CHECK( tokens[1]==string("xX") );
|
||||
BOOST_CHECK( tokens[2]==string("xx") );
|
||||
#endif
|
||||
|
||||
// split tests
|
||||
split(
|
||||
tokens,
|
||||
@ -144,6 +168,21 @@ void iterator_test()
|
||||
BOOST_REQUIRE( tokens.size()==1 );
|
||||
BOOST_CHECK( tokens[0]==string("") );
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
// If using a compiler that supports forwarding references, we should be able to use rvalues, too
|
||||
split(
|
||||
tokens,
|
||||
string("Xx-abc--xX-abb-xx"),
|
||||
is_any_of("xX"),
|
||||
token_compress_on );
|
||||
|
||||
BOOST_REQUIRE( tokens.size()==4 );
|
||||
BOOST_CHECK( tokens[0]==string("") );
|
||||
BOOST_CHECK( tokens[1]==string("-abc--") );
|
||||
BOOST_CHECK( tokens[2]==string("-abb-") );
|
||||
BOOST_CHECK( tokens[3]==string("") );
|
||||
#endif
|
||||
|
||||
|
||||
find_iterator<string::iterator> fiter=make_find_iterator(str1, first_finder("xx"));
|
||||
find_iterator<string::iterator> fiter2;
|
||||
|
@ -16,7 +16,7 @@ alias unit_test_framework
|
||||
|
||||
|
||||
{
|
||||
test-suite algorithm:
|
||||
test-suite algorithm
|
||||
# Search tests
|
||||
: [ run empty_search_test.cpp unit_test_framework : : : : empty_search_test ]
|
||||
[ run search_test1.cpp unit_test_framework : : : : search_test1 ]
|
||||
|
@ -12,22 +12,21 @@
|
||||
|
||||
#include <boost/algorithm/apply_permutation.hpp>
|
||||
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
namespace ba = boost::algorithm;
|
||||
|
||||
|
||||
void test_apply_permutation()
|
||||
BOOST_AUTO_TEST_CASE(test_apply_permutation)
|
||||
{
|
||||
//Empty
|
||||
{
|
||||
std::vector<int> vec, order, result;
|
||||
|
||||
ba::apply_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//1 element
|
||||
{
|
||||
@ -37,7 +36,7 @@ void test_apply_permutation()
|
||||
result = vec;
|
||||
|
||||
ba::apply_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//2 elements, no changes
|
||||
{
|
||||
@ -47,7 +46,7 @@ void test_apply_permutation()
|
||||
result = vec;
|
||||
|
||||
ba::apply_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//2 elements, changed
|
||||
{
|
||||
@ -57,7 +56,7 @@ void test_apply_permutation()
|
||||
result.push_back(2); result.push_back(1);
|
||||
|
||||
ba::apply_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//Multiple elements, no changes
|
||||
{
|
||||
@ -67,7 +66,7 @@ void test_apply_permutation()
|
||||
result = vec;
|
||||
|
||||
ba::apply_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//Multiple elements, changed
|
||||
{
|
||||
@ -77,7 +76,7 @@ void test_apply_permutation()
|
||||
result.push_back(5); result.push_back(4); result.push_back(3); result.push_back(2); result.push_back(1);
|
||||
|
||||
ba::apply_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//Just test range interface
|
||||
{
|
||||
@ -87,18 +86,18 @@ void test_apply_permutation()
|
||||
result = vec;
|
||||
|
||||
ba::apply_permutation(vec, order);
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
}
|
||||
|
||||
void test_apply_reverse_permutation()
|
||||
BOOST_AUTO_TEST_CASE(test_apply_reverse_permutation)
|
||||
{
|
||||
//Empty
|
||||
{
|
||||
std::vector<int> vec, order, result;
|
||||
|
||||
ba::apply_reverse_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//1 element
|
||||
{
|
||||
@ -108,7 +107,7 @@ void test_apply_reverse_permutation()
|
||||
result = vec;
|
||||
|
||||
ba::apply_reverse_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//2 elements, no changes
|
||||
{
|
||||
@ -118,7 +117,7 @@ void test_apply_reverse_permutation()
|
||||
result = vec;
|
||||
|
||||
ba::apply_reverse_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//2 elements, changed
|
||||
{
|
||||
@ -128,7 +127,7 @@ void test_apply_reverse_permutation()
|
||||
result.push_back(2); result.push_back(1);
|
||||
|
||||
ba::apply_reverse_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//Multiple elements, no changes
|
||||
{
|
||||
@ -138,7 +137,7 @@ void test_apply_reverse_permutation()
|
||||
result = vec;
|
||||
|
||||
ba::apply_reverse_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//Multiple elements, changed
|
||||
{
|
||||
@ -148,7 +147,7 @@ void test_apply_reverse_permutation()
|
||||
result.push_back(5); result.push_back(4); result.push_back(3); result.push_back(2); result.push_back(1);
|
||||
|
||||
ba::apply_reverse_permutation(vec.begin(), vec.end(), order.begin(), order.end());
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
//Just test range interface
|
||||
{
|
||||
@ -158,12 +157,6 @@ void test_apply_reverse_permutation()
|
||||
result = vec;
|
||||
|
||||
ba::apply_reverse_permutation(vec, order);
|
||||
BOOST_CHECK(vec == result);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(vec.begin(), vec.end(), result.begin(), result.end());
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_main)
|
||||
{
|
||||
test_apply_permutation();
|
||||
test_apply_reverse_permutation();
|
||||
}
|
||||
|
Reference in New Issue
Block a user