From 3437477789333db3180bdcac0027234b17a164b8 Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Thu, 29 Mar 2007 08:30:29 +0000 Subject: [PATCH] for-each.html at el. [SVN r37316] --- doc/refmanual/algorithms.html | 3 +- doc/refmanual/for-each.html | 165 +++++++++++++++++ doc/refmanual/refmanual_toc.html | 244 +++++++++++++------------- doc/refmanual/runtime-algorithms.html | 31 ++++ 4 files changed, 322 insertions(+), 121 deletions(-) create mode 100644 doc/refmanual/for-each.html create mode 100644 doc/refmanual/runtime-algorithms.html diff --git a/doc/refmanual/algorithms.html b/doc/refmanual/algorithms.html index d7d7b74..e87c335 100644 --- a/doc/refmanual/algorithms.html +++ b/doc/refmanual/algorithms.html @@ -46,13 +46,14 @@ transformation algorithm provides a revers allowing for a wider range of efficient transformations — a common functionality documented by the Reversible Algorithm concept.

- + diff --git a/doc/refmanual/for-each.html b/doc/refmanual/for-each.html new file mode 100644 index 0000000..413345f --- /dev/null +++ b/doc/refmanual/for-each.html @@ -0,0 +1,165 @@ + + + + + + + + + +The MPL Reference Manual: for_each + + + + + +
Front Page / Algorithms / Runtime Algorithms / for_each
+
+

for_each

+
+

Synopsis

+
+template<
+      typename Sequence
+    , typename F
+    >
+void for_each( F f );
+
+template<
+      typename Sequence
+    , typename TransformOp
+    , typename F
+    >
+void for_each( F f );
+
+
+
+

Description

+

for_each is a family of overloaded function templates:

+
    +
  • for_each<Sequence>( f ) applies the runtime function object +f to every element in the [begin<Sequence>::type, end<Sequence>::type) range.
  • +
  • for_each<Sequence,TransformOp>( f ) applies the runtime function +object f to the result of the transformation TransformOp of +every element in the [begin<Sequence>::type, end<Sequence>::type) range.
  • +
+
+
+

Header

+
+#include <boost/mpl/for_each.hpp>
+
+
+
+

Parameters

+ +++++ + + + + + + + + + + + + + + + + + + + + +
ParameterRequirementDescription
SequenceForward SequenceA sequence to iterate.
TransformOpLambda ExpressionA transformation.
fAn unary function objectA runtime operation to apply.
+
+
+

Expression semantics

+

For any Forward Sequence s, Lambda Expression op , and an +unary function object f:

+
+for_each<s>( f );
+
+ +++ + + + + + +
Return type:void
Postcondition:

Equivalent to

+
+typedef begin<Sequence>::type i1;
+value_initialized< deref<i1>::type > x1;
+f(boost::get(x1));
+
+typedef next<i1>::type i2;
+value_initialized< deref<i2>::type > x2;
+f(boost::get(x2));
+...
+value_initialized< deref<in>::type > xn;
+f(boost::get(xn));
+typedef next<in>::type last; 
+
+

where n == size<s>::value and last is identical to +end<s>::type; no effect if empty<s>::value == true.

+
+
+for_each<s,op>( f );
+
+ +++ + + + + + +
Return type:void
Postcondition:

Equivalent to

+
+for_each< tranform_view<s,op> >( f );
+
+
+
+
+

Complexity

+

Linear. Exactly size<s>::value applications of op and f.

+
+
+

Example

+
+struct value_printer
+{
+    template< typename U > void operator()(U x)
+    {
+        std::cout << x << 'n';
+    }
+};
+
+int main()
+{
+    for_each< range_c<int,0,10> >( value_printer() );
+}
+
+
+ +
+ + + + + diff --git a/doc/refmanual/refmanual_toc.html b/doc/refmanual/refmanual_toc.html index 91d4559..791ce7f 100644 --- a/doc/refmanual/refmanual_toc.html +++ b/doc/refmanual/refmanual_toc.html @@ -155,148 +155,152 @@
  • reverse_stable_partition
  • - - -
  • Metafunctions