1 /*=============================================================================
2 Copyright (c) 2011 Eric Niebler
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(BOOST_FUSION_SEGMENTED_END_IMPL_HPP_INCLUDED)
8 #define BOOST_FUSION_SEGMENTED_END_IMPL_HPP_INCLUDED
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/mpl/assert.hpp>
12 #include <boost/type_traits/add_const.hpp>
13 #include <boost/type_traits/remove_reference.hpp>
14 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
15 #include <boost/fusion/container/list/cons_fwd.hpp>
16 #include <boost/fusion/support/is_segmented.hpp>
18 namespace boost { namespace fusion
20 template <typename First, typename Last>
21 struct iterator_range;
24 namespace boost { namespace fusion { namespace detail
26 //auto segmented_end_impl( seq, stack )
28 // assert(is_segmented(seq));
29 // auto it = end(segments(seq));
30 // return cons(iterator_range(it, it), stack);
33 template <typename Sequence, typename Stack>
34 struct segmented_end_impl
36 BOOST_MPL_ASSERT((traits::is_segmented<Sequence>));
39 typename result_of::end<
40 typename remove_reference<
42 typename result_of::segments<Sequence>::type
48 typedef iterator_range<end_type, end_type> pair_type;
49 typedef cons<pair_type, Stack> type;
51 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
52 static pair_type make_pair(end_type end)
54 return pair_type(end, end);
57 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
58 static type call(Sequence & seq, Stack stack)
61 make_pair(fusion::end(fusion::segments(seq))),