1 /*=============================================================================
2 Copyright (c) 2007 Tobias Schwinger
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 ==============================================================================*/
8 #if !defined(BOOST_FUSION_REPETITIVE_VIEW_NEXT_IMPL_HPP_INCLUDED)
9 #define BOOST_FUSION_REPETITIVE_VIEW_NEXT_IMPL_HPP_INCLUDED
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/iterator/next.hpp>
13 #include <boost/fusion/iterator/equal_to.hpp>
15 namespace boost { namespace fusion
17 struct repetitive_view_iterator_tag;
19 template <typename Sequence, typename Pos>
20 struct repetitive_view_iterator;
24 template <typename Tag>
28 struct next_impl<repetitive_view_iterator_tag>
30 template<typename Iterator,
31 bool Last = result_of::equal_to<typename Iterator::end_type,
32 typename result_of::next<
33 typename Iterator::pos_type
35 struct apply_nonempty // <Iterator,false>
37 // advanvce to next position
39 typedef repetitive_view_iterator<
40 typename Iterator::sequence_type,
41 typename result_of::next<typename Iterator::pos_type>::type
45 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
46 static type call(Iterator const& i)
48 return type(i.seq, next(i.pos));
51 template <typename Iterator>
52 struct apply_nonempty<Iterator,true>
56 typedef repetitive_view_iterator<
57 typename Iterator::sequence_type,
58 typename Iterator::first_type
62 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
63 static type call(Iterator const& i)
69 template <typename Iterator,
70 bool Empty = result_of::equal_to<typename Iterator::end_type,
71 typename Iterator::pos_type>::value >
72 struct apply // <Iterator,false>
73 : apply_nonempty<Iterator>
76 template <typename Iterator>
77 struct apply<Iterator,true>
81 typedef Iterator type;
83 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
84 static type call(Iterator const& i)