1 #ifndef OPENFPM_FOR_EACH_HPP_INCLUDED
2 #define OPENFPM_FOR_EACH_HPP_INCLUDED
17 #include <boost/mpl/is_sequence.hpp>
18 #include <boost/mpl/begin_end.hpp>
19 #include <boost/mpl/apply.hpp>
20 #include <boost/mpl/bool.hpp>
21 #include <boost/mpl/next_prior.hpp>
22 #include <boost/mpl/deref.hpp>
23 #include <boost/mpl/identity.hpp>
24 #include <boost/mpl/assert.hpp>
25 #include <boost/mpl/aux_/unwrap.hpp>
27 #include <boost/type_traits/is_same.hpp>
28 #include <boost/utility/value_init.hpp>
30 namespace boost {
namespace mpl {
34 template<
bool done = true >
39 ,
typename LastIterator
40 ,
typename TransformFunc
58 ,
typename LastIterator
59 ,
typename TransformFunc
69 typedef typename deref<Iterator>::type item;
70 typedef typename apply1<TransformFunc,item>::type arg;
74 value_initialized<arg> x;
75 aux::unwrap(f, 0)(boost::get(x));
77 typedef typename mpl::next<Iterator>::type iter;
79 ::execute( static_cast<iter*>(0), static_cast<LastIterator*>(0), static_cast<TransformFunc*>(0), f);
89 ,
typename TransformOp
93 void for_each_ref(
F & f, Sequence* = 0, TransformOp* = 0)
95 BOOST_MPL_ASSERT(( is_sequence<Sequence> ));
97 typedef typename begin<Sequence>::type first;
98 typedef typename end<Sequence>::type last;
101 ::execute(static_cast<first*>(0), static_cast<last*>(0), static_cast<TransformOp*>(0), f);
109 void for_each_ref(
F & f, Sequence* = 0)
111 for_each_ref<Sequence, identity<> >(f);
116 #endif // OPENFPM_FOR_EACH_HPP_INCLUDED
[v_transform metafunction]