Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003     Copyright (c) 2006 Dan Marsden
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 ==============================================================================*/
0008 #if !defined(FUSION_STRICTEST_TRAVERSAL_20060123_2101)
0009 #define FUSION_STRICTEST_TRAVERSAL_20060123_2101
0010 
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/config.hpp>
0013 #include <boost/mpl/or.hpp>
0014 #include <boost/mpl/if.hpp>
0015 #include <boost/fusion/support/category_of.hpp>
0016 #include <boost/fusion/mpl.hpp>
0017 #include <boost/fusion/algorithm/iteration/fold.hpp>
0018 #include <boost/type_traits/remove_reference.hpp>
0019 #include <boost/type_traits/is_convertible.hpp>
0020 
0021 namespace boost { namespace fusion
0022 {
0023     struct forward_traversal_tag;
0024     struct bidirectional_traversal_tag;
0025     struct random_access_traversal_tag;
0026 
0027     namespace detail
0028     {
0029         template<typename Tag1, typename Tag2,
0030             bool Tag1Stricter = boost::is_convertible<Tag2,Tag1>::value>
0031         struct stricter_traversal
0032         {
0033             typedef Tag1 type;
0034         };
0035 
0036         template<typename Tag1, typename Tag2>
0037         struct stricter_traversal<Tag1,Tag2,false>
0038         {
0039             typedef Tag2 type;
0040         };
0041 
0042         struct strictest_traversal_impl
0043         {
0044             template<typename Sig>
0045             struct result;
0046 
0047             template<typename StrictestSoFar, typename Next>
0048             struct result<strictest_traversal_impl(StrictestSoFar, Next)>
0049             {
0050                 typedef typename remove_reference<Next>::type next_value;
0051                 typedef typename remove_reference<StrictestSoFar>::type strictest_so_far;
0052 
0053                 typedef strictest_so_far tag1;
0054                 typedef typename traits::category_of<next_value>::type tag2;
0055 
0056                 typedef typename stricter_traversal<tag1,tag2>::type type;
0057             };
0058 
0059             // never called, but needed for decltype-based result_of (C++0x)
0060 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0061             template<typename StrictestSoFar, typename Next>
0062             BOOST_FUSION_GPU_ENABLED
0063             typename result<strictest_traversal_impl(StrictestSoFar, Next)>::type
0064             operator()(StrictestSoFar&&, Next&&) const;
0065 #endif
0066         };
0067 
0068         template<typename Sequence>
0069         struct strictest_traversal
0070             : result_of::fold<
0071             Sequence, fusion::random_access_traversal_tag,
0072             strictest_traversal_impl>
0073         {};
0074 
0075     }
0076 }}
0077 
0078 #endif