]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2007 Tobias Schwinger | |
3 | ||
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 | ||
8 | #ifndef BOOST_FUSION_REPETITIVE_VIEW_ITERATOR_HPP_INCLUDED | |
9 | #define BOOST_FUSION_REPETITIVE_VIEW_ITERATOR_HPP_INCLUDED | |
10 | ||
11 | #include <boost/fusion/support/config.hpp> | |
12 | #include <boost/fusion/support/iterator_base.hpp> | |
13 | #include <boost/fusion/support/category_of.hpp> | |
14 | #include <boost/fusion/iterator/mpl/convert_iterator.hpp> | |
15 | #include <boost/fusion/adapted/mpl/mpl_iterator.hpp> | |
16 | #include <boost/fusion/sequence/intrinsic/begin.hpp> | |
17 | #include <boost/fusion/sequence/intrinsic/end.hpp> | |
18 | #include <boost/fusion/view/repetitive_view/detail/deref_impl.hpp> | |
19 | #include <boost/fusion/view/repetitive_view/detail/next_impl.hpp> | |
20 | #include <boost/fusion/view/repetitive_view/detail/value_of_impl.hpp> | |
21 | ||
22 | namespace boost { namespace fusion | |
23 | { | |
24 | struct repetitive_view_iterator_tag; | |
25 | ||
26 | template<typename Sequence, typename Pos = | |
27 | typename result_of::begin<Sequence>::type> | |
28 | struct repetitive_view_iterator | |
29 | : iterator_base< repetitive_view_iterator<Sequence,Pos> > | |
30 | { | |
31 | typedef repetitive_view_iterator_tag fusion_tag; | |
32 | ||
33 | typedef Sequence sequence_type; | |
34 | typedef typename convert_iterator<Pos>::type pos_type; | |
35 | typedef typename convert_iterator<typename result_of::begin<Sequence>::type>::type first_type; | |
36 | typedef typename convert_iterator<typename result_of::end<Sequence>::type>::type end_type; | |
37 | typedef single_pass_traversal_tag category; | |
38 | ||
39 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
40 | explicit repetitive_view_iterator(Sequence& in_seq) | |
41 | : seq(in_seq), pos(begin(in_seq)) {} | |
42 | ||
43 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
44 | repetitive_view_iterator(Sequence& in_seq, pos_type const& in_pos) | |
45 | : seq(in_seq), pos(in_pos) {} | |
46 | ||
47 | Sequence& seq; | |
48 | pos_type pos; | |
49 | ||
50 | private: | |
51 | // silence MSVC warning C4512: assignment operator could not be generated | |
52 | repetitive_view_iterator& operator= (repetitive_view_iterator const&); | |
53 | }; | |
54 | }} | |
55 | ||
56 | #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 | |
57 | namespace std | |
58 | { | |
59 | template <typename Sequence, typename Pos> | |
60 | struct iterator_traits< ::boost::fusion::repetitive_view_iterator<Sequence, Pos> > | |
61 | { }; | |
62 | } | |
63 | #endif | |
64 | ||
65 | #endif | |
66 |