File indexing completed on 2024-11-15 09:14:48
0001
0002
0003
0004
0005
0006 #ifndef BOOST_ITERATOR_CATEGORIES_HPP
0007 # define BOOST_ITERATOR_CATEGORIES_HPP
0008
0009 # include <boost/config.hpp>
0010 # include <boost/iterator/detail/config_def.hpp>
0011
0012 # include <boost/detail/workaround.hpp>
0013
0014 # include <boost/mpl/eval_if.hpp>
0015 # include <boost/mpl/identity.hpp>
0016 # include <boost/mpl/placeholders.hpp>
0017 # include <boost/mpl/aux_/lambda_support.hpp>
0018
0019 # include <boost/type_traits/is_convertible.hpp>
0020
0021 # include <boost/static_assert.hpp>
0022
0023 #include <iterator>
0024
0025 namespace boost {
0026 namespace iterators {
0027
0028
0029
0030
0031
0032 struct no_traversal_tag {};
0033
0034 struct incrementable_traversal_tag
0035 : no_traversal_tag
0036 {
0037
0038
0039 };
0040
0041 struct single_pass_traversal_tag
0042 : incrementable_traversal_tag
0043 {
0044
0045
0046 };
0047
0048 struct forward_traversal_tag
0049 : single_pass_traversal_tag
0050 {
0051
0052
0053 };
0054
0055 struct bidirectional_traversal_tag
0056 : forward_traversal_tag
0057 {
0058
0059
0060 };
0061
0062 struct random_access_traversal_tag
0063 : bidirectional_traversal_tag
0064 {
0065
0066
0067 };
0068
0069 namespace detail
0070 {
0071
0072
0073
0074
0075
0076
0077 template <class Cat>
0078 struct old_category_to_traversal
0079 : mpl::eval_if<
0080 is_convertible<Cat,std::random_access_iterator_tag>
0081 , mpl::identity<random_access_traversal_tag>
0082 , mpl::eval_if<
0083 is_convertible<Cat,std::bidirectional_iterator_tag>
0084 , mpl::identity<bidirectional_traversal_tag>
0085 , mpl::eval_if<
0086 is_convertible<Cat,std::forward_iterator_tag>
0087 , mpl::identity<forward_traversal_tag>
0088 , mpl::eval_if<
0089 is_convertible<Cat,std::input_iterator_tag>
0090 , mpl::identity<single_pass_traversal_tag>
0091 , mpl::eval_if<
0092 is_convertible<Cat,std::output_iterator_tag>
0093 , mpl::identity<incrementable_traversal_tag>
0094 , void
0095 >
0096 >
0097 >
0098 >
0099 >
0100 {};
0101
0102 }
0103
0104
0105
0106
0107 template <class Cat>
0108 struct iterator_category_to_traversal
0109 : mpl::eval_if<
0110 is_convertible<Cat,incrementable_traversal_tag>
0111 , mpl::identity<Cat>
0112 , boost::iterators::detail::old_category_to_traversal<Cat>
0113 >
0114 {};
0115
0116
0117 template <class Iterator = mpl::_1>
0118 struct iterator_traversal
0119 : iterator_category_to_traversal<
0120 typename std::iterator_traits<Iterator>::iterator_category
0121 >
0122 {};
0123
0124 # ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
0125
0126
0127
0128
0129
0130 template <>
0131 struct iterator_traversal<mpl::_1>
0132 {
0133 template <class T>
0134 struct apply : iterator_traversal<T>
0135 {};
0136 };
0137 template <>
0138 struct iterator_traversal<mpl::_>
0139 : iterator_traversal<mpl::_1>
0140 {};
0141 # endif
0142
0143
0144
0145
0146 template <class Traversal>
0147 struct pure_traversal_tag
0148 : mpl::eval_if<
0149 is_convertible<Traversal,random_access_traversal_tag>
0150 , mpl::identity<random_access_traversal_tag>
0151 , mpl::eval_if<
0152 is_convertible<Traversal,bidirectional_traversal_tag>
0153 , mpl::identity<bidirectional_traversal_tag>
0154 , mpl::eval_if<
0155 is_convertible<Traversal,forward_traversal_tag>
0156 , mpl::identity<forward_traversal_tag>
0157 , mpl::eval_if<
0158 is_convertible<Traversal,single_pass_traversal_tag>
0159 , mpl::identity<single_pass_traversal_tag>
0160 , mpl::eval_if<
0161 is_convertible<Traversal,incrementable_traversal_tag>
0162 , mpl::identity<incrementable_traversal_tag>
0163 , void
0164 >
0165 >
0166 >
0167 >
0168 >
0169 {
0170 };
0171
0172
0173
0174
0175 template <class Iterator = mpl::_1>
0176 struct pure_iterator_traversal
0177 : pure_traversal_tag<typename iterator_traversal<Iterator>::type>
0178 {};
0179
0180 # ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
0181 template <>
0182 struct pure_iterator_traversal<mpl::_1>
0183 {
0184 template <class T>
0185 struct apply : pure_iterator_traversal<T>
0186 {};
0187 };
0188 template <>
0189 struct pure_iterator_traversal<mpl::_>
0190 : pure_iterator_traversal<mpl::_1>
0191 {};
0192 # endif
0193
0194 }
0195
0196 using iterators::no_traversal_tag;
0197 using iterators::incrementable_traversal_tag;
0198 using iterators::single_pass_traversal_tag;
0199 using iterators::forward_traversal_tag;
0200 using iterators::bidirectional_traversal_tag;
0201 using iterators::random_access_traversal_tag;
0202 using iterators::iterator_category_to_traversal;
0203 using iterators::iterator_traversal;
0204
0205
0206
0207
0208 namespace detail {
0209 using iterators::pure_traversal_tag;
0210 }
0211
0212 }
0213
0214 #include <boost/iterator/detail/config_undef.hpp>
0215
0216 #endif