/*============================================================================= Copyright (c) 2011 Eric Niebler Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_FUSION_SEGMENTED_BEGIN_IMPL_HPP_INCLUDED) #define BOOST_FUSION_SEGMENTED_BEGIN_IMPL_HPP_INCLUDED #include #include #include #include #include #include #include namespace boost { namespace fusion { template struct iterator_range; }} namespace boost { namespace fusion { namespace detail { struct segmented_begin_fun { template struct apply { typedef iterator_range< typename fusion::result_of::begin::type , typename fusion::result_of::end::type > range_type; typedef cons type; typedef mpl::false_ continue_type; BOOST_FUSION_GPU_ENABLED static type call(Sequence& seq, State const&, Context const& context, segmented_begin_fun) { return type(range_type(fusion::begin(seq), fusion::end(seq)), context); } }; }; template ::type::value> struct segmented_begin_impl_aux { typedef segmented_end_impl end_impl; typedef segmented_fold_until_impl< Sequence , typename end_impl::type , Stack , segmented_begin_fun > fold_impl; typedef typename fold_impl::type type; BOOST_FUSION_GPU_ENABLED static type call(Sequence& seq, Stack const& stack) { return fold_impl::call(seq, end_impl::call(seq, stack), stack, segmented_begin_fun()); } }; template struct segmented_begin_impl_aux { typedef typename result_of::begin::type begin_type; typedef typename result_of::end::type end_type; typedef iterator_range pair_type; typedef cons type; BOOST_FUSION_GPU_ENABLED static type call(Sequence& seq, Stack stack) { return type(pair_type(fusion::begin(seq), fusion::end(seq)), stack); } }; template struct segmented_begin_impl : segmented_begin_impl_aux {}; }}} #endif