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_CONVERT_ITERATOR_05062005_1218)
0008 #define FUSION_CONVERT_ITERATOR_05062005_1218
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/support/is_iterator.hpp>
0012 #include <boost/mpl/if.hpp>
0013 #include <boost/mpl/bool.hpp>
0014 
0015 namespace boost { namespace fusion
0016 {
0017     template <typename Iterator>
0018     struct mpl_iterator; // forward declaration
0019 
0020     //  Test T. If it is a fusion iterator, return a reference to it.
0021     //  else, assume it is an mpl iterator.
0022 
0023     template <typename T>
0024     struct convert_iterator
0025     {
0026         typedef typename
0027             mpl::if_<
0028                 is_fusion_iterator<T>
0029               , T
0030               , mpl_iterator<T>
0031             >::type
0032         type;
0033 
0034         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0035         static T const&
0036         call(T const& x, mpl::true_)
0037         {
0038             return x;
0039         }
0040 
0041         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0042         static mpl_iterator<T>
0043         call(T const& /*x*/, mpl::false_)
0044         {
0045             return mpl_iterator<T>();
0046         }
0047 
0048         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0049         static typename
0050             mpl::if_<
0051                 is_fusion_iterator<T>
0052               , T const&
0053               , mpl_iterator<T>
0054             >::type
0055         call(T const& x)
0056         {
0057             return call(x, is_fusion_iterator<T>());
0058         }
0059     };
0060 }}
0061 
0062 #endif