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_DISTANCE_09172005_0730)
0008 #define FUSION_DISTANCE_09172005_0730
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/next.hpp>
0015 #include <boost/mpl/identity.hpp>
0016 #include <boost/fusion/iterator/next.hpp>
0017 #include <boost/fusion/iterator/equal_to.hpp>
0018 
0019 namespace boost { namespace fusion { namespace distance_detail
0020 {
0021     // Default distance implementation, linear
0022     // search for the Last iterator.
0023 
0024     template <typename First, typename Last>
0025     struct linear_distance;
0026 
0027     template <typename First, typename Last>
0028     struct next_distance
0029     {
0030         typedef typename 
0031             mpl::next<
0032                 typename linear_distance<
0033                     typename result_of::next<First>::type
0034                   , Last
0035                 >::type
0036             >::type 
0037         type;
0038     };
0039 
0040     template <typename First, typename Last>
0041     struct linear_distance
0042         : mpl::eval_if<
0043             result_of::equal_to<First, Last>
0044           , mpl::identity<mpl::int_<0> >
0045           , next_distance<First, Last>
0046         >::type
0047     {
0048         typedef typename
0049             mpl::eval_if<
0050                 result_of::equal_to<First, Last>
0051               , mpl::identity<mpl::int_<0> >
0052               , next_distance<First, Last>
0053             >::type
0054         type;
0055 
0056         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0057         static type
0058         call(First const&, Last const&)
0059         {
0060             return type();
0061         }
0062     };
0063 
0064 }}}
0065 
0066 #endif