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/mpl/assert.hpp>
11 #include <boost/type_traits/add_const.hpp>
12 #include <boost/type_traits/remove_reference.hpp>
13 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
14 #include <boost/fusion/container/list/cons_fwd.hpp>
15 #include <boost/fusion/support/is_segmented.hpp>
17 namespace boost { namespace fusion
19 template <typename First, typename Last>
20 struct iterator_range;
23 namespace boost { namespace fusion { namespace detail
25 //auto segmented_end_impl( seq, stack )
27 // assert(is_segmented(seq));
28 // auto it = end(segments(seq));
29 // return cons(iterator_range(it, it), stack);
32 template <typename Sequence, typename Stack>
33 struct segmented_end_impl
35 BOOST_MPL_ASSERT((traits::is_segmented<Sequence>));
38 typename result_of::end<
39 typename remove_reference<
41 typename result_of::segments<Sequence>::type
47 typedef iterator_range<end_type, end_type> pair_type;
48 typedef cons<pair_type, Stack> type;
50 static type call(Sequence & seq, Stack stack)
52 end_type end = fusion::end(fusion::segments(seq));
53 return type(pair_type(end, end), stack);