Chris@16: /*============================================================================= Chris@16: Copyright (c) 2001-2011 Joel de Guzman Chris@16: Chris@16: Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: ==============================================================================*/ Chris@16: #if !defined(FUSION_ADVANCE_09172005_1149) Chris@16: #define FUSION_ADVANCE_09172005_1149 Chris@16: Chris@101: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace fusion { namespace advance_detail Chris@16: { Chris@16: // Default advance implementation, perform next(i) Chris@16: // or prior(i) N times. Chris@16: Chris@16: template Chris@16: struct forward; Chris@16: Chris@16: template Chris@16: struct next_forward Chris@16: { Chris@16: typedef typename Chris@16: forward< Chris@16: typename result_of::next::type Chris@16: , N-1 Chris@16: >::type Chris@16: type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct forward Chris@16: { Chris@16: typedef typename Chris@16: mpl::eval_if_c< Chris@16: (N == 0) Chris@16: , mpl::identity Chris@16: , next_forward Chris@16: >::type Chris@16: type; Chris@16: Chris@101: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED Chris@16: static type const& Chris@16: call(type const& i) Chris@16: { Chris@16: return i; Chris@16: } Chris@16: Chris@16: template Chris@101: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED Chris@16: static type Chris@16: call(I const& i) Chris@16: { Chris@16: return call(fusion::next(i)); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct backward; Chris@16: Chris@16: template Chris@16: struct next_backward Chris@16: { Chris@16: typedef typename Chris@16: backward< Chris@16: typename result_of::prior::type Chris@16: , N+1 Chris@16: >::type Chris@16: type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct backward Chris@16: { Chris@16: typedef typename Chris@16: mpl::eval_if_c< Chris@16: (N == 0) Chris@16: , mpl::identity Chris@16: , next_backward Chris@16: >::type Chris@16: type; Chris@16: Chris@101: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED Chris@16: static type const& Chris@16: call(type const& i) Chris@16: { Chris@16: return i; Chris@16: } Chris@16: Chris@16: template Chris@101: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED Chris@16: static type Chris@16: call(I const& i) Chris@16: { Chris@16: return call(fusion::prior(i)); Chris@16: } Chris@16: }; Chris@16: Chris@16: }}} Chris@16: Chris@16: #endif