1 /*============================================================================= 2 Copyright (c) 2001-2011 Joel de Guzman 3 Copyright (c) 2005 Eric Niebler 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 ==============================================================================*/ 8 #if !defined(FUSION_NEXT_IMPL_07172005_0836) 9 #define FUSION_NEXT_IMPL_07172005_0836 10 11 #include <boost/fusion/support/config.hpp> 12 #include <boost/fusion/iterator/next.hpp> 13 #include <boost/fusion/iterator/equal_to.hpp> 14 #include <boost/mpl/eval_if.hpp> 15 #include <boost/mpl/identity.hpp> 16 #include <boost/type_traits/is_const.hpp> 17 #include <boost/type_traits/add_const.hpp> 18 19 namespace boost { namespace fusion 20 { 21 struct cons_iterator_tag; 22 23 template <typename Cons> 24 struct cons_iterator; 25 26 namespace extension 27 { 28 template <typename Tag> 29 struct next_impl; 30 31 template <> 32 struct next_impl<cons_iterator_tag> 33 { 34 template <typename Iterator> 35 struct apply 36 { 37 typedef typename Iterator::cons_type cons_type; 38 typedef typename cons_type::cdr_type cdr_type; 39 40 typedef cons_iterator< 41 typename mpl::eval_if< 42 is_const<cons_type> 43 , add_const<cdr_type> 44 , mpl::identity<cdr_type> 45 >::type> 46 type; 47 48 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 49 static type callboost::fusion::extension::next_impl::apply50 call(Iterator const& i) 51 { 52 return type(i.cons.cdr); 53 } 54 }; 55 }; 56 } 57 }} 58 59 #endif 60 61 62