Merged changes for Boost.Algorithm to release; Fixes #6596; Fixes #6689; Fixes #3215; Fixes #6840

[SVN r78557]
This commit is contained in:
Marshall Clow
2012-05-23 16:25:48 +00:00
parent 76cd99ed53
commit 563fe27a59
7 changed files with 18 additions and 9 deletions

View File

@ -12,6 +12,7 @@
#ifndef BOOST_ALGORITHM_ALL_OF_HPP #ifndef BOOST_ALGORITHM_ALL_OF_HPP
#define BOOST_ALGORITHM_ALL_OF_HPP #define BOOST_ALGORITHM_ALL_OF_HPP
#include <algorithm> // for std::all_of, if available
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@ -14,6 +14,7 @@
#ifndef BOOST_ALGORITHM_ANY_OF_HPP #ifndef BOOST_ALGORITHM_ANY_OF_HPP
#define BOOST_ALGORITHM_ANY_OF_HPP #define BOOST_ALGORITHM_ANY_OF_HPP
#include <algorithm> // for std::any_of, if available
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@ -12,6 +12,7 @@
#ifndef BOOST_ALGORITHM_NONE_OF_HPP #ifndef BOOST_ALGORITHM_NONE_OF_HPP
#define BOOST_ALGORITHM_NONE_OF_HPP #define BOOST_ALGORITHM_NONE_OF_HPP
#include <algorithm> // for std::none_of, if available
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@ -12,6 +12,7 @@
#ifndef BOOST_ALGORITHM_PARTITION_COPY_HPP #ifndef BOOST_ALGORITHM_PARTITION_COPY_HPP
#define BOOST_ALGORITHM_PARTITION_COPY_HPP #define BOOST_ALGORITHM_PARTITION_COPY_HPP
#include <algorithm> // for std::partition_copy, if available
#include <utility> // for make_pair #include <utility> // for make_pair
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>

View File

@ -20,7 +20,7 @@
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
// Use the C++11 versions of iota if it is available // Use the C++11 versions of partition_point if it is available
using std::partition_point; // Section 25.3.13 using std::partition_point; // Section 25.3.13
#else #else
/// \fn partition_point ( ForwardIterator first, ForwardIterator last, Predicate p ) /// \fn partition_point ( ForwardIterator first, ForwardIterator last, Predicate p )

View File

@ -228,13 +228,13 @@ namespace boost {
//! Find head algorithm //! Find head algorithm
/*! /*!
Get the head of the input. Head is a prefix of the string of the Get the head of the input. Head is a prefix of the string of the
given size. If the input is shorter then required, whole input if considered given size. If the input is shorter then required, whole input is considered
to be the head. to be the head.
\param Input An input string \param Input An input string
\param N Length of the head \param N Length of the head
For N>=0, at most N characters are extracted. For N>=0, at most N characters are extracted.
For N<0, size(Input)-|N| characters are extracted. For N<0, at most size(Input)-|N| characters are extracted.
\return \return
An \c iterator_range delimiting the match. An \c iterator_range delimiting the match.
Returned iterator is either \c Range1T::iterator or Returned iterator is either \c Range1T::iterator or
@ -258,13 +258,13 @@ namespace boost {
//! Find tail algorithm //! Find tail algorithm
/*! /*!
Get the tail of the input. Tail is a suffix of the string of the Get the tail of the input. Tail is a suffix of the string of the
given size. If the input is shorter then required, whole input if considered given size. If the input is shorter then required, whole input is considered
to be the tail. to be the tail.
\param Input An input string \param Input An input string
\param N Length of the tail. \param N Length of the tail.
For N>=0, at most N characters are extracted. For N>=0, at most N characters are extracted.
For N<0, size(Input)-|N| characters are extracted. For N<0, at most size(Input)-|N| characters are extracted.
\return \return
An \c iterator_range delimiting the match. An \c iterator_range delimiting the match.
Returned iterator is either \c RangeT::iterator or Returned iterator is either \c RangeT::iterator or

View File

@ -135,12 +135,12 @@
&lt;&lt; endl; // prints "command.com is an executable" &lt;&lt; endl; // prints "command.com is an executable"
//.. //..
char text1[]="hello world!"; char text1[]="hello";
cout cout
&lt;&lt; text1 &lt;&lt; text1
&lt;&lt; (all( text1, is_lower() )? "is": "is not") &lt;&lt; (all( text1, is_lower() )? " is": " is not")
&lt;&lt; " written in the lower case" &lt;&lt; " written in the lower case"
&lt;&lt; endl; // prints "hello world! is written in the lower case" &lt;&lt; endl; // prints "hello is written in the lower case"
</programlisting> </programlisting>
<para> <para>
The predicates determine whether if a substring is contained in the input string The predicates determine whether if a substring is contained in the input string
@ -149,6 +149,11 @@
simply contains the substring or if both strings are equal. See the reference for simply contains the substring or if both strings are equal. See the reference for
<headername>boost/algorithm/string/predicate.hpp</headername> for more details. <headername>boost/algorithm/string/predicate.hpp</headername> for more details.
</para> </para>
<para>
Note that if we had used "hello world" as the input to the test, it would have
output "hello world is not written in the lower case" because the space in the
input string is not a lower case letter.
</para>
<para> <para>
In addition the algorithm <functionname>all()</functionname> checks In addition the algorithm <functionname>all()</functionname> checks
all elements of a container to satisfy a condition specified by a predicate. all elements of a container to satisfy a condition specified by a predicate.
@ -163,7 +168,7 @@
<title>Trimming</title> <title>Trimming</title>
<para> <para>
When parsing the input from a user, strings usually have unwanted leading or trailing When parsing the input from a user, strings often have unwanted leading or trailing
characters. To get rid of them, we need trim functions: characters. To get rid of them, we need trim functions:
</para> </para>
<programlisting> <programlisting>