1 /*=============================================================================
2 Copyright (c) 2009 Christopher Schmidt
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 #ifndef BOOST_FUSION_ITERATOR_BASIC_ITERATOR_HPP
9 #define BOOST_FUSION_ITERATOR_BASIC_ITERATOR_HPP
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/iterator/iterator_facade.hpp>
14 #include <boost/mpl/and.hpp>
15 #include <boost/mpl/equal_to.hpp>
16 #include <boost/mpl/minus.hpp>
17 #include <boost/mpl/int.hpp>
18 #include <boost/type_traits/is_same.hpp>
19 #include <boost/type_traits/remove_const.hpp>
21 namespace boost { namespace fusion
32 struct value_of_data_impl;
38 struct deref_data_impl;
41 template<typename Tag, typename Category, typename Seq, int Index>
43 : iterator_facade<basic_iterator<Tag, Category, Seq, Index>, Category>
45 typedef mpl::int_<Index> index;
48 template <typename It>
50 : extension::value_of_impl<Tag>::template apply<It>
53 template <typename It>
55 : extension::deref_impl<Tag>::template apply<It>
58 template <typename It>
60 : extension::value_of_data_impl<Tag>::template apply<It>
63 template <typename It>
65 : extension::key_of_impl<Tag>::template apply<It>
68 template <typename It>
70 : extension::deref_data_impl<Tag>::template apply<It>
73 template <typename It, typename N>
77 basic_iterator<Tag, Category, Seq, Index + N::value>
80 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
84 return type(*it.seq,0);
88 template <typename It>
90 : advance<It, mpl::int_<1> >
93 template <typename It>
95 : advance<It, mpl::int_<-1> >
98 template <typename It1, typename It2>
101 typedef mpl::minus<typename It2::index, typename It1::index> type;
103 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
106 call(It1 const&, It2 const&)
112 template <typename It1, typename It2>
116 typename remove_const<typename It1::seq_type>::type
117 , typename remove_const<typename It2::seq_type>::type
119 , mpl::equal_to<typename It1::index,typename It2::index>
123 template<typename OtherSeq>
124 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
125 basic_iterator(basic_iterator<Tag,Category,OtherSeq,Index> const& it)
129 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
130 basic_iterator(Seq& in_seq, int)
134 template<typename OtherSeq>
135 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
137 operator=(basic_iterator<Tag,Category,OtherSeq,Index> const& it)
147 #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
150 template <typename Tag, typename Category, typename Seq, int Index>
151 struct iterator_traits< ::boost::fusion::basic_iterator<Tag, Category, Seq, Index> >