Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*=============================================================================
0002     Copyright (c) 2011 Eric Niebler
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(BOOST_FUSION_SEGMENTED_END_IMPL_HPP_INCLUDED)
0008 #define BOOST_FUSION_SEGMENTED_END_IMPL_HPP_INCLUDED
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/mpl/assert.hpp>
0012 #include <boost/type_traits/add_const.hpp>
0013 #include <boost/type_traits/remove_reference.hpp>
0014 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
0015 #include <boost/fusion/container/list/cons_fwd.hpp>
0016 #include <boost/fusion/support/is_segmented.hpp>
0017 
0018 namespace boost { namespace fusion
0019 {
0020     template <typename First, typename Last>
0021     struct iterator_range;
0022 }}
0023 
0024 namespace boost { namespace fusion { namespace detail
0025 {
0026     //auto segmented_end_impl( seq, stack )
0027     //{
0028     //    assert(is_segmented(seq));
0029     //    auto it = end(segments(seq));
0030     //    return cons(iterator_range(it, it), stack);
0031     //}
0032 
0033     template <typename Sequence, typename Stack>
0034     struct segmented_end_impl
0035     {
0036         BOOST_MPL_ASSERT((traits::is_segmented<Sequence>));
0037 
0038         typedef
0039             typename result_of::end<
0040                 typename remove_reference<
0041                     typename add_const<
0042                         typename result_of::segments<Sequence>::type
0043                     >::type
0044                 >::type
0045             >::type
0046         end_type;
0047 
0048         typedef iterator_range<end_type, end_type>  pair_type;
0049         typedef cons<pair_type, Stack>              type;
0050 
0051         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0052         static pair_type make_pair(end_type end)
0053         {
0054             return pair_type(end, end);
0055         }
0056 
0057         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0058         static type call(Sequence & seq, Stack stack)
0059         {
0060             return type(
0061                 make_pair(fusion::end(fusion::segments(seq))),
0062                 stack);
0063         }
0064     };
0065 
0066 }}}
0067 
0068 #endif