Boost logo

Boost-Commit :

From: chochlik_at_[hidden]
Date: 2008-05-16 14:33:44


Author: matus.chochlik
Date: 2008-05-16 14:33:44 EDT (Fri, 16 May 2008)
New Revision: 45441
URL: http://svn.boost.org/trac/boost/changeset/45441

Log:
 - Added for_each and reverse_for_each working on a iterator range
Text files modified:
   sandbox/mirror/boost/mirror/algorithm/for_each.hpp | 33 +++++++++++++++++++++++++++++++++
   sandbox/mirror/boost/mirror/algorithm/reverse_for_each.hpp | 34 ++++++++++++++++++++++++++++++++++
   sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp | 10 ++++++++++
   3 files changed, 77 insertions(+), 0 deletions(-)

Modified: sandbox/mirror/boost/mirror/algorithm/for_each.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/algorithm/for_each.hpp (original)
+++ sandbox/mirror/boost/mirror/algorithm/for_each.hpp 2008-05-16 14:33:44 EDT (Fri, 16 May 2008)
@@ -90,6 +90,39 @@
> ::perform(ref(fn), ref(transf));
 }
 
+template <
+ class IteratorBegin,
+ class IteratorEnd,
+ class Functor
+>
+static inline reference_wrapper<Functor> for_each(
+ reference_wrapper<Functor> fn
+)
+{
+ return detail::for_each_impl<
+ IteratorBegin,
+ IteratorEnd
+ > ::perform(fn, cref(detail::no_op()));
+}
+
+template <
+ class IteratorBegin,
+ class IteratorEnd,
+ class TransformOp,
+ class Functor
+>
+static inline reference_wrapper<Functor> for_each(
+ reference_wrapper<TransformOp> transf,
+ reference_wrapper<Functor> fn
+)
+{
+ return detail::for_each_impl<
+ IteratorBegin,
+ IteratorEnd
+ > ::perform(fn, transf);
+}
+
+
 
 } // namespace mirror
 } // namespace boost

Modified: sandbox/mirror/boost/mirror/algorithm/reverse_for_each.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/algorithm/reverse_for_each.hpp (original)
+++ sandbox/mirror/boost/mirror/algorithm/reverse_for_each.hpp 2008-05-16 14:33:44 EDT (Fri, 16 May 2008)
@@ -90,6 +90,40 @@
> ::perform(ref(fn), ref(transf));
 }
 
+template <
+ class IteratorBegin,
+ class IteratorEnd,
+ class Functor
+>
+static reference_wrapper<Functor> reverse_for_each(
+ reference_wrapper<Functor> fn
+)
+{
+ return detail::reverse_for_each_impl<
+ IteratorBegin,
+ IteratorEnd
+ > ::perform(fn, cref(detail::no_op()));
+}
+
+template <
+ class IteratorBegin,
+ class IteratorEnd,
+ class TransformOp,
+ class Functor
+>
+static Functor reverse_for_each(
+ reference_wrapper<TransformOp> transf,
+ reference_wrapper<Functor> fn
+)
+{
+ return detail::reverse_for_each_impl<
+ IteratorBegin,
+ IteratorEnd
+ > ::perform(fn, transf);
+}
+
+
+
 } // namespace mirror
 } // namespace boost
 

Modified: sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp (original)
+++ sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp 2008-05-16 14:33:44 EDT (Fri, 16 May 2008)
@@ -128,6 +128,16 @@
         bcout << "---------------------------------------------------" << endl;
         for_each<meta_X::all_attributes>(cref(select_base_name()), cref(str_printer()));
         bcout << "---------------------------------------------------" << endl;
+ for_each<
+ begin<meta_X::all_attributes>::type,
+ end<meta_X::all_attributes>::type
+ >(cref(select_base_name()), cref(str_printer()));
+ bcout << "---------------------------------------------------" << endl;
+ reverse_for_each<
+ begin<meta_X::all_attributes>::type,
+ end<meta_X::all_attributes>::type
+ >(cref(select_base_name()), cref(str_printer()));
+ bcout << "---------------------------------------------------" << endl;
         bcout << "Finished" << endl;
 
         return 0;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk