Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:41

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(FUSION_ADVANCE_09172005_1149)
0008 #define FUSION_ADVANCE_09172005_1149
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/mpl/int.hpp>
0012 #include <boost/mpl/if.hpp>
0013 #include <boost/mpl/eval_if.hpp>
0014 #include <boost/mpl/identity.hpp>
0015 #include <boost/fusion/iterator/next.hpp>
0016 #include <boost/fusion/iterator/prior.hpp>
0017 
0018 namespace boost { namespace fusion { namespace advance_detail
0019 {
0020     // Default advance implementation, perform next(i)
0021     // or prior(i) N times.
0022 
0023     template <typename Iterator, int N>
0024     struct forward;
0025 
0026     template <typename Iterator, int N>
0027     struct next_forward
0028     {
0029         typedef typename
0030             forward<
0031                 typename result_of::next<Iterator>::type
0032               , N-1
0033             >::type
0034         type;
0035     };
0036 
0037     template <typename Iterator, int N>
0038     struct forward
0039     {
0040         typedef typename
0041             mpl::eval_if_c<
0042                 (N == 0)
0043               , mpl::identity<Iterator>
0044               , next_forward<Iterator, N>
0045             >::type
0046         type;
0047 
0048         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0049         static type const&
0050         call(type const& i)
0051         {
0052             return i;
0053         }
0054 
0055         template <typename I>
0056         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0057         static type
0058         call(I const& i)
0059         {
0060             return call(fusion::next(i));
0061         }
0062     };
0063 
0064     template <typename Iterator, int N>
0065     struct backward;
0066 
0067     template <typename Iterator, int N>
0068     struct next_backward
0069     {
0070         typedef typename
0071             backward<
0072                 typename result_of::prior<Iterator>::type
0073               , N+1
0074             >::type
0075         type;
0076     };
0077 
0078     template <typename Iterator, int N>
0079     struct backward
0080     {
0081         typedef typename
0082             mpl::eval_if_c<
0083                 (N == 0)
0084               , mpl::identity<Iterator>
0085               , next_backward<Iterator, N>
0086             >::type
0087         type;
0088 
0089         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0090         static type const&
0091         call(type const& i)
0092         {
0093             return i;
0094         }
0095 
0096         template <typename I>
0097         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0098         static type
0099         call(I const& i)
0100         {
0101             return call(fusion::prior(i));
0102         }
0103     };
0104 
0105 }}}
0106 
0107 #endif