#ifndef BOOST_MPL_FOR_EACH_HPP_INCLUDED #define BOOST_MPL_FOR_EACH_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace mpl { namespace aux { template< bool done = true > struct for_each_impl { template< typename Iterator , typename LastIterator , typename TransformFunc , typename F > BOOST_MPL_CFG_GPU_ENABLED static void execute( Iterator* , LastIterator* , TransformFunc* , F ) { } }; template<> struct for_each_impl { template< typename Iterator , typename LastIterator , typename TransformFunc , typename F > BOOST_MPL_CFG_GPU_ENABLED static void execute( Iterator* , LastIterator* , TransformFunc* , F f ) { typedef typename deref::type item; typedef typename apply1::type arg; // dwa 2002/9/10 -- make sure not to invoke undefined behavior // when we pass arg. value_initialized x; aux::unwrap(f, 0)(boost::get(x)); typedef typename mpl::next::type iter; for_each_impl::value> ::execute( static_cast(0), static_cast(0), static_cast(0), f); } }; } // namespace aux // agurt, 17/mar/02: pointer default parameters are necessary to workaround // MSVC 6.5 function template signature's mangling bug template< typename Sequence , typename TransformOp , typename F > BOOST_MPL_CFG_GPU_ENABLED inline void for_each(F f, Sequence* = 0, TransformOp* = 0) { BOOST_MPL_ASSERT(( is_sequence )); typedef typename begin::type first; typedef typename end::type last; aux::for_each_impl< boost::is_same::value > ::execute(static_cast(0), static_cast(0), static_cast(0), f); } template< typename Sequence , typename F > BOOST_MPL_CFG_GPU_ENABLED inline void for_each(F f, Sequence* = 0) { // jfalcou: fully qualifying this call so it doesnt clash with phoenix::for_each // ons ome compilers -- done on 02/28/2011 boost::mpl::for_each >(f); } }} #endif // BOOST_MPL_FOR_EACH_HPP_INCLUDED