]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2011 Joel de Guzman | |
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 | #if !defined(FUSION_REVERSE_VIEW_ITERATOR_07202005_0835) | |
8 | #define FUSION_REVERSE_VIEW_ITERATOR_07202005_0835 | |
9 | ||
10 | #include <boost/fusion/support/config.hpp> | |
11 | #include <boost/fusion/support/iterator_base.hpp> | |
12 | #include <boost/fusion/support/category_of.hpp> | |
13 | #include <boost/fusion/iterator/mpl/convert_iterator.hpp> | |
14 | #include <boost/fusion/adapted/mpl/mpl_iterator.hpp> | |
15 | #include <boost/fusion/view/reverse_view/detail/deref_impl.hpp> | |
16 | #include <boost/fusion/view/reverse_view/detail/next_impl.hpp> | |
17 | #include <boost/fusion/view/reverse_view/detail/prior_impl.hpp> | |
18 | #include <boost/fusion/view/reverse_view/detail/advance_impl.hpp> | |
19 | #include <boost/fusion/view/reverse_view/detail/distance_impl.hpp> | |
20 | #include <boost/fusion/view/reverse_view/detail/value_of_impl.hpp> | |
21 | #include <boost/fusion/view/reverse_view/detail/deref_data_impl.hpp> | |
22 | #include <boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp> | |
23 | #include <boost/fusion/view/reverse_view/detail/key_of_impl.hpp> | |
24 | #include <boost/type_traits/is_base_of.hpp> | |
25 | #include <boost/static_assert.hpp> | |
26 | ||
27 | namespace boost { namespace fusion | |
28 | { | |
29 | struct reverse_view_iterator_tag; | |
30 | ||
31 | template <typename First> | |
32 | struct reverse_view_iterator | |
33 | : iterator_base<reverse_view_iterator<First> > | |
34 | { | |
35 | typedef convert_iterator<First> converter; | |
36 | typedef typename converter::type first_type; | |
37 | typedef reverse_view_iterator_tag fusion_tag; | |
38 | typedef typename traits::category_of<first_type>::type category; | |
39 | ||
40 | BOOST_STATIC_ASSERT(( | |
41 | is_base_of< | |
42 | bidirectional_traversal_tag | |
43 | , category>::value)); | |
44 | ||
45 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
46 | reverse_view_iterator(First const& in_first) | |
47 | : first(converter::call(in_first)) {} | |
48 | ||
49 | first_type first; | |
50 | ||
51 | private: | |
52 | // silence MSVC warning C4512: assignment operator could not be generated | |
53 | reverse_view_iterator& operator= (reverse_view_iterator const&); | |
54 | }; | |
55 | }} | |
56 | ||
57 | #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 | |
58 | namespace std | |
59 | { | |
60 | template <typename First> | |
61 | struct iterator_traits< ::boost::fusion::reverse_view_iterator<First> > | |
62 | { }; | |
63 | } | |
64 | #endif | |
65 | ||
66 | #endif | |
67 |