1 #ifndef OPENFPM_FOR_EACH_HOST_HPP_INCLUDED 2 #define OPENFPM_FOR_EACH_HOST_HPP_INCLUDED 18 #include "util/cuda_util.hpp" 19 #include <boost/mpl/is_sequence.hpp> 20 #include <boost/mpl/begin_end.hpp> 21 #include <boost/mpl/apply.hpp> 22 #include <boost/mpl/bool.hpp> 23 #include <boost/mpl/next_prior.hpp> 24 #include <boost/mpl/deref.hpp> 25 #include <boost/mpl/identity.hpp> 26 #include <boost/mpl/assert.hpp> 27 #include <boost/mpl/aux_/unwrap.hpp> 29 #include <boost/type_traits/is_same.hpp> 30 #include <boost/utility/value_init.hpp> 32 #if defined(__NVCC__) && !defined(__INTEL_COMPILER) 33 #pragma hd_warning_disable 36 namespace boost {
namespace mpl {
40 template<
bool done = true >
45 ,
typename LastIterator
46 ,
typename TransformFunc
64 ,
typename LastIterator
65 ,
typename TransformFunc
75 typedef typename deref<Iterator>::type item;
76 typedef typename apply1<TransformFunc,item>::type arg;
80 value_initialized<arg> x;
81 aux::unwrap(f, 0)(boost::get(x));
83 typedef typename mpl::next<Iterator>::type iter;
85 ::execute( static_cast<iter*>(0), static_cast<LastIterator*>(0), static_cast<TransformFunc*>(0), f);
95 ,
typename TransformOp
98 inline void for_each_ref_host(
F & f, Sequence* = 0, TransformOp* = 0)
100 BOOST_MPL_ASSERT(( is_sequence<Sequence> ));
102 typedef typename begin<Sequence>::type first;
103 typedef typename end<Sequence>::type last;
106 ::execute(static_cast<first*>(0), static_cast<last*>(0), static_cast<TransformOp*>(0), f);
114 void for_each_ref_host(
F & f, Sequence* = 0)
116 for_each_ref_host<Sequence, identity<> >(f);
121 #endif // OPENFPM_FOR_EACH_HPP_INCLUDED
[v_transform metafunction]