From d12dd64125e770b136a1c119fde39b79bdd6b951 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 16 Jan 2003 22:41:06 +0000 Subject: [PATCH] Implement default-identity version [SVN r16917] --- include/boost/mpl/for_each.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/boost/mpl/for_each.hpp b/include/boost/mpl/for_each.hpp index 524453a..58be86c 100644 --- a/include/boost/mpl/for_each.hpp +++ b/include/boost/mpl/for_each.hpp @@ -21,6 +21,7 @@ #include "boost/mpl/apply.hpp" #include "boost/mpl/bool_c.hpp" #include "boost/mpl/lambda.hpp" +#include "boost/mpl/identity.hpp" #include "boost/mpl/aux_/unwrap.hpp" #include "boost/type_traits/is_same.hpp" @@ -72,7 +73,7 @@ struct for_each_impl // dwa 2002/9/10 -- make sure not to invoke undefined behavior // when we pass arg. value_initialized x; - aux::unwrap(f, 0)(get(x)); + aux::unwrap(f, 0)(boost::get(x)); typedef typename Iterator::next iter; for_each_impl::value>::execute( @@ -100,6 +101,16 @@ void for_each(F f, Sequence* = 0, TransformOp* = 0) (first*)0, (last*)0, (transform_op*)0, f); } +template< + typename Sequence + , typename F + > +inline +void for_each(F f, Sequence* = 0) +{ + for_each >(f); +} + } // namespace mpl } // namespace boost