File indexing completed on 2025-01-18 09:40:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP
0015 #define BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP
0016
0017 #ifndef BOOST_CONFIG_HPP
0018 # include <boost/config.hpp>
0019 #endif
0020 #
0021 #if defined(BOOST_HAS_PRAGMA_ONCE)
0022 # pragma once
0023 #endif
0024
0025 #if (BOOST_CXX_VERSION > 201703L) && defined(__cpp_lib_concepts)
0026
0027 #include <iterator>
0028
0029 #define BOOST_MOVE_CONTIGUOUS_ITERATOR_TAG
0030
0031 namespace boost {
0032 namespace movelib {
0033
0034 using std::iterator_traits;
0035
0036 template<class T>
0037 struct iter_difference
0038 {
0039 typedef typename std::iterator_traits<T>::difference_type type;
0040 };
0041
0042 template<class T>
0043 struct iter_value
0044 {
0045 typedef typename std::iterator_traits<T>::value_type type;
0046 };
0047
0048 template<class T>
0049 struct iter_category
0050 {
0051 typedef typename std::iterator_traits<T>::iterator_category type;
0052 };
0053
0054 }}
0055
0056 #else
0057
0058 #include <cstddef>
0059 #include <boost/move/detail/type_traits.hpp>
0060
0061 #include <boost/move/detail/std_ns_begin.hpp>
0062
0063 BOOST_MOVE_STD_NS_BEG
0064
0065 struct input_iterator_tag;
0066 struct forward_iterator_tag;
0067 struct bidirectional_iterator_tag;
0068 struct random_access_iterator_tag;
0069 struct output_iterator_tag;
0070
0071 #if ( (defined(BOOST_GNU_STDLIB) && (__cplusplus > 201703L))\
0072 || (defined(_LIBCPP_VERSION) && (_LIBCPP_STD_VER > 17))\
0073 || (defined(_YVALS) && defined(_CPPLIB_VER) && defined(__cpp_lib_concepts))\
0074 || (__cplusplus >= 202002L)\
0075 )
0076 # define BOOST_MOVE_CONTIGUOUS_ITERATOR_TAG
0077 struct contiguous_iterator_tag;
0078
0079 #endif
0080
0081 BOOST_MOVE_STD_NS_END
0082
0083 #include <boost/move/detail/std_ns_end.hpp>
0084
0085 namespace boost{ namespace movelib{
0086
0087 template<class T>
0088 struct iter_difference
0089 {
0090 typedef typename T::difference_type type;
0091 };
0092
0093 template<class T>
0094 struct iter_difference<T*>
0095 {
0096 typedef std::ptrdiff_t type;
0097 };
0098
0099 template<class T>
0100 struct iter_value
0101 {
0102 typedef typename T::value_type type;
0103 };
0104
0105 template<class T>
0106 struct iter_value<T*>
0107 {
0108 typedef T type;
0109 };
0110
0111 template<class T>
0112 struct iter_value<const T*>
0113 {
0114 typedef T type;
0115 };
0116
0117 template<class T>
0118 struct iter_category
0119 {
0120 typedef typename T::iterator_category type;
0121 };
0122
0123
0124 template<class T>
0125 struct iter_category<T*>
0126 {
0127 typedef std::random_access_iterator_tag type;
0128 };
0129
0130 template<class Iterator>
0131 struct iterator_traits
0132 {
0133 typedef typename iter_difference<Iterator>::type difference_type;
0134 typedef typename iter_value<Iterator>::type value_type;
0135 typedef typename Iterator::pointer pointer;
0136 typedef typename Iterator::reference reference;
0137 typedef typename iter_category<Iterator>::type iterator_category;
0138 };
0139
0140 template<class T>
0141 struct iterator_traits<T*>
0142 {
0143 typedef std::ptrdiff_t difference_type;
0144 typedef T value_type;
0145 typedef T* pointer;
0146 typedef T& reference;
0147 typedef std::random_access_iterator_tag iterator_category;
0148 };
0149
0150 template<class T>
0151 struct iterator_traits<const T*>
0152 {
0153 typedef std::ptrdiff_t difference_type;
0154 typedef T value_type;
0155 typedef const T* pointer;
0156 typedef const T& reference;
0157 typedef std::random_access_iterator_tag iterator_category;
0158 };
0159
0160 }}
0161
0162 #endif
0163
0164 #include <boost/move/detail/type_traits.hpp>
0165
0166 namespace boost {
0167 namespace movelib {
0168
0169 template<class T>
0170 struct iter_size
0171 : boost::move_detail::
0172 make_unsigned<typename iter_difference<T>::type >
0173 {};
0174
0175 }}
0176
0177 #endif