Warning, file /include/boost/fusion/container/map/map_iterator.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(BOOST_FUSION_MAP_ITERATOR_02042013_0835)
0009 #define BOOST_FUSION_MAP_ITERATOR_02042013_0835
0010
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/fusion/iterator/iterator_facade.hpp>
0013 #include <boost/mpl/minus.hpp>
0014 #include <boost/mpl/equal_to.hpp>
0015 #include <boost/mpl/if.hpp>
0016 #include <boost/utility/declval.hpp>
0017 #include <boost/type_traits/is_const.hpp>
0018 #include <boost/type_traits/add_const.hpp>
0019
0020 #ifdef _MSC_VER
0021 # pragma warning(push)
0022 # pragma warning(disable: 4512)
0023 #endif
0024
0025 namespace boost { namespace fusion
0026 {
0027 struct random_access_traversal_tag;
0028
0029 template <typename Seq, int Pos>
0030 struct map_iterator
0031 : iterator_facade<
0032 map_iterator<Seq, Pos>
0033 , typename Seq::category>
0034 {
0035 typedef Seq sequence;
0036 typedef mpl::int_<Pos> index;
0037
0038 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0039 map_iterator(Seq& seq)
0040 : seq_(seq)
0041 {}
0042
0043 template<typename Iterator>
0044 struct value_of
0045 {
0046 typedef typename Iterator::sequence sequence;
0047 typedef typename Iterator::index index;
0048 typedef
0049 decltype(boost::declval<sequence>().get_val(index()))
0050 type;
0051 };
0052
0053 template<typename Iterator>
0054 struct value_of_data
0055 {
0056 typedef typename Iterator::sequence sequence;
0057 typedef typename Iterator::index index;
0058 typedef
0059 decltype(boost::declval<sequence>().get_val(index()).second)
0060 type;
0061 };
0062
0063 template<typename Iterator>
0064 struct key_of
0065 {
0066 typedef typename Iterator::sequence sequence;
0067 typedef typename Iterator::index index;
0068 typedef decltype(boost::declval<sequence>().get_key(index())) key_identity_type;
0069 typedef typename key_identity_type::type type;
0070 };
0071
0072 template<typename Iterator>
0073 struct deref
0074 {
0075 typedef typename Iterator::sequence sequence;
0076 typedef typename Iterator::index index;
0077 typedef
0078 decltype(boost::declval<sequence>().get(index()))
0079 type;
0080
0081 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0082 static type
0083 call(Iterator const& it)
0084 {
0085 return it.seq_.get(typename Iterator::index());
0086 }
0087 };
0088
0089 template<typename Iterator>
0090 struct deref_data
0091 {
0092 typedef typename Iterator::sequence sequence;
0093 typedef typename Iterator::index index;
0094
0095 typedef decltype(boost::declval<sequence>().get(index()).second) second_type_;
0096
0097 typedef typename
0098 mpl::if_<
0099 is_const<sequence>
0100 , typename add_const<second_type_>::type
0101 , second_type_
0102 >::type
0103 second_type;
0104
0105 typedef typename add_reference<second_type>::type type;
0106
0107 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0108 static type
0109 call(Iterator const& it)
0110 {
0111 return it.seq_.get(typename Iterator::index()).second;
0112 }
0113 };
0114
0115 template <typename Iterator, typename N>
0116 struct advance
0117 {
0118 typedef typename Iterator::index index;
0119 typedef typename Iterator::sequence sequence;
0120 typedef map_iterator<sequence, index::value + N::value> type;
0121
0122 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0123 static type
0124 call(Iterator const& i)
0125 {
0126 return type(i.seq_);
0127 }
0128 };
0129
0130 template<typename Iterator>
0131 struct next
0132 : advance<Iterator, mpl::int_<1> >
0133 {};
0134
0135 template<typename Iterator>
0136 struct prior
0137 : advance<Iterator, mpl::int_<-1> >
0138 {};
0139
0140 template <typename I1, typename I2>
0141 struct distance
0142 {
0143 typedef typename
0144 mpl::minus<
0145 typename I2::index, typename I1::index
0146 >::type
0147 type;
0148
0149 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0150 static type
0151 call(I1 const&, I2 const&)
0152 {
0153 return type();
0154 }
0155 };
0156
0157 template<typename I1, typename I2>
0158 struct equal_to
0159 : mpl::equal_to<typename I1::index, typename I2::index>
0160 {};
0161
0162 Seq& seq_;
0163 };
0164 }}
0165
0166 #ifdef _MSC_VER
0167 # pragma warning(pop)
0168 #endif
0169
0170 #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
0171 namespace std
0172 {
0173 template <typename Seq, int Pos>
0174 struct iterator_traits< ::boost::fusion::map_iterator<Seq, Pos> >
0175 { };
0176 }
0177 #endif
0178
0179 #endif