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/iterator/iterator_facade.hpp>
13 #include <boost/mpl/and.hpp>
14 #include <boost/mpl/equal_to.hpp>
15 #include <boost/mpl/minus.hpp>
16 #include <boost/mpl/int.hpp>
17 #include <boost/type_traits/is_same.hpp>
18 #include <boost/type_traits/remove_const.hpp>
20 namespace boost { namespace fusion
31 struct value_of_data_impl;
37 struct deref_data_impl;
40 template<typename Tag, typename Category, typename Seq, int Index>
42 : iterator_facade<basic_iterator<Tag,Category,Seq,Index>, Category>
44 typedef mpl::int_<Index> index;
47 template <typename It>
49 : extension::value_of_impl<Tag>::template apply<It>
52 template <typename It>
54 : extension::deref_impl<Tag>::template apply<It>
57 template <typename It>
59 : extension::value_of_data_impl<Tag>::template apply<It>
62 template <typename It>
64 : extension::key_of_impl<Tag>::template apply<It>
67 template <typename It>
69 : extension::deref_data_impl<Tag>::template apply<It>
72 template <typename It, typename N>
76 basic_iterator<Tag, Category, Seq, Index + N::value>
82 return type(*it.seq,0);
86 template <typename It>
88 : advance<It, mpl::int_<1> >
91 template <typename It>
93 : advance<It, mpl::int_<-1> >
96 template <typename It1, typename It2>
99 typedef mpl::minus<typename It2::index, typename It1::index> type;
103 call(It1 const&, It2 const&)
109 template <typename It1, typename It2>
113 typename remove_const<typename It1::seq_type>::type
114 , typename remove_const<typename It2::seq_type>::type
116 , mpl::equal_to<typename It1::index,typename It2::index>
120 template<typename OtherSeq>
121 basic_iterator(basic_iterator<Tag,Category,OtherSeq,Index> const& it)
125 basic_iterator(Seq& in_seq, int)
129 template<typename OtherSeq>
131 operator=(basic_iterator<Tag,Category,OtherSeq,Index> const& it)