forked from boostorg/algorithm
Compare commits
1 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
45d96385d1 |
@ -92,11 +92,11 @@ Synopsis of <tt><boost/algorithm/minmax.hpp></tt></h3>
|
|||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
tuple<T const&, T const&>
|
tuple<T const&, T const&> >
|
||||||
minmax(const T& a, const T& b);
|
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="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||||
tuple<T const&, T const&>
|
tuple<T const&, T const&> >
|
||||||
minmax(const T& a, const T& b, BinaryPredicate comp);
|
minmax(const T& a, const T& b, BinaryPredicate comp);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ range
|
|||||||
|
|
||||||
<a name="complexity">
|
<a name="complexity">
|
||||||
<h3>
|
<h3>
|
||||||
Complexity</h3>
|
<a NAME="Complexity"></a>Complexity</h3>
|
||||||
Minmax performs a single comparison and is otherwise of constant complexity.
|
Minmax performs a single comparison and is otherwise of constant complexity.
|
||||||
The use of <tt>boost::tuple<T const&></tt> prevents copy
|
The use of <tt>boost::tuple<T const&></tt> prevents copy
|
||||||
constructors in case the arguments are passed by reference.
|
constructors in case the arguments are passed by reference.
|
||||||
@ -438,7 +438,7 @@ comparisons).</p>
|
|||||||
slower than
|
slower than
|
||||||
<tt>first_min_element</tt> alone, still much less than <tt>first_min_element</tt>
|
<tt>first_min_element</tt> alone, still much less than <tt>first_min_element</tt>
|
||||||
and
|
and
|
||||||
<tt>last_max_element</tt> called separately. <a href="#Note2">[2]</a>
|
<tt>last_max_element</tt> called separately. <a href="#Performance">[2]</a>
|
||||||
|
|
||||||
<h4><b>Why algorithms and not accumulators?</b></h4>
|
<h4><b>Why algorithms and not accumulators?</b></h4>
|
||||||
<p>The minmax algorithms are useful in computing the extent of a range.
|
<p>The minmax algorithms are useful in computing the extent of a range.
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
<emphasis role="bold">Definition:</emphasis> A string is a
|
<emphasis role="bold">Definition:</emphasis> A string is a
|
||||||
<ulink url="../../libs/range/index.html">range</ulink> of characters accessible in sequential
|
<ulink url="../../libs/range/doc/range.html">range</ulink> of characters accessible in sequential
|
||||||
ordered fashion. Character is any value type with "cheap" copying and assignment.
|
ordered fashion. Character is any value type with "cheap" copying and assignment.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<librarypurpose>
|
<librarypurpose>
|
||||||
A set of generic string-related algorithms and utilities
|
A set of generic string-related algorithms and utilities
|
||||||
</librarypurpose>
|
</librarypurpose>
|
||||||
<librarycategory name="category:algorithms"/>
|
<librarycategory name="category:algoritms"/>
|
||||||
<librarycategory name="category:string-text"/>
|
<librarycategory name="category:string-text"/>
|
||||||
</libraryinfo>
|
</libraryinfo>
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
The magic of <ulink url="../../libs/range/index.html">Boost.Range</ulink>
|
The magic of <ulink url="../../libs/range/index.html">Boost.Range</ulink>
|
||||||
provides a uniform way of handling different string types.
|
provides a uniform way of handling different string types.
|
||||||
If there is a need to pass a pair of iterators,
|
If there is a need to pass a pair of iterators,
|
||||||
<ulink url="../../libs/range/doc/html/range/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink>
|
<ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>
|
||||||
can be used to package iterators into a structure with a compatible interface.
|
can be used to package iterators into a structure with a compatible interface.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@ -208,7 +208,7 @@
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
We have used <functionname>find_last()</functionname> to search the <code>text</code> for "ll".
|
We have used <functionname>find_last()</functionname> to search the <code>text</code> for "ll".
|
||||||
The result is given in the <ulink url="../../libs/range/doc/html/range/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink>.
|
The result is given in the <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>.
|
||||||
This range delimits the
|
This range delimits the
|
||||||
part of the input which satisfies the find criteria. In our example it is the last occurrence of "ll".
|
part of the input which satisfies the find criteria. In our example it is the last occurrence of "ll".
|
||||||
|
|
||||||
@ -217,7 +217,7 @@
|
|||||||
<ulink url="../../libs/range/index.html">Boost.Range</ulink>.
|
<ulink url="../../libs/range/index.html">Boost.Range</ulink>.
|
||||||
|
|
||||||
The following lines transform the result. Notice that
|
The following lines transform the result. Notice that
|
||||||
<ulink url="../../libs/range/doc/html/range/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink> has familiar
|
<ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink> has familiar
|
||||||
<code>begin()</code> and <code>end()</code> methods, so it can be used like any other STL container.
|
<code>begin()</code> and <code>end()</code> methods, so it can be used like any other STL container.
|
||||||
Also it is convertible to bool therefore it is easy to use find algorithms for a simple containment checking.
|
Also it is convertible to bool therefore it is easy to use find algorithms for a simple containment checking.
|
||||||
</para>
|
</para>
|
||||||
@ -264,7 +264,7 @@
|
|||||||
the find iterator allows us to iterate over the substrings matching the specified criteria.
|
the find iterator allows us to iterate over the substrings matching the specified criteria.
|
||||||
This facility is using the <link linkend="string_algo.finder_concept">Finder</link> to incrementally
|
This facility is using the <link linkend="string_algo.finder_concept">Finder</link> to incrementally
|
||||||
search the string.
|
search the string.
|
||||||
Dereferencing a find iterator yields an <ulink url="../../libs/range/doc/html/range/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink>
|
Dereferencing a find iterator yields an <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>
|
||||||
object, that delimits the current match.
|
object, that delimits the current match.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
@ -339,7 +339,7 @@
|
|||||||
typedef vector< string > split_vector_type;
|
typedef vector< string > split_vector_type;
|
||||||
|
|
||||||
split_vector_type SplitVec; // #2: Search for tokens
|
split_vector_type SplitVec; // #2: Search for tokens
|
||||||
split( SplitVec, str1, is_any_of("-*"), token_compress_on ); // SplitVec == { "hello abc","ABC","aBc goodbye" }
|
split( SplitVec, str1, is_any_of("-*") ); // SplitVec == { "hello abc","ABC","aBc goodbye" }
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
<code>[hello]</code> designates an <code>iterator_range</code> delimiting this substring.
|
<code>[hello]</code> designates an <code>iterator_range</code> delimiting this substring.
|
||||||
|
Reference in New Issue
Block a user