File indexing completed on 2025-01-30 09:44:35
0001
0002
0003
0004 #ifndef IS_LVALUE_ITERATOR_DWA2003112_HPP
0005 # define IS_LVALUE_ITERATOR_DWA2003112_HPP
0006
0007 #include <boost/detail/workaround.hpp>
0008
0009 #include <boost/type_traits/add_lvalue_reference.hpp>
0010 #include <boost/iterator/detail/any_conversion_eater.hpp>
0011 #include <boost/mpl/bool.hpp>
0012 #include <boost/mpl/aux_/lambda_support.hpp>
0013
0014 #include <iterator>
0015
0016
0017 #include <boost/type_traits/integral_constant.hpp>
0018 #include <boost/iterator/detail/config_def.hpp>
0019
0020 #ifndef BOOST_NO_IS_CONVERTIBLE
0021
0022 namespace boost {
0023
0024 namespace iterators {
0025
0026 namespace detail
0027 {
0028 #ifndef BOOST_NO_LVALUE_RETURN_DETECTION
0029
0030
0031
0032 struct not_an_lvalue {};
0033
0034 template <class T>
0035 T& lvalue_preserver(T&, int);
0036
0037 template <class U>
0038 not_an_lvalue lvalue_preserver(U const&, ...);
0039
0040 # define BOOST_LVALUE_PRESERVER(expr) detail::lvalue_preserver(expr,0)
0041
0042 #else
0043
0044 # define BOOST_LVALUE_PRESERVER(expr) expr
0045
0046 #endif
0047
0048
0049
0050 template <class Value>
0051 struct is_lvalue_iterator_impl
0052 {
0053
0054
0055 struct conversion_eater
0056 {
0057 conversion_eater(typename add_lvalue_reference<Value>::type);
0058 };
0059
0060 static char tester(conversion_eater, int);
0061 static char (& tester(any_conversion_eater, ...) )[2];
0062
0063 template <class It>
0064 struct rebind
0065 {
0066 static It& x;
0067
0068 BOOST_STATIC_CONSTANT(
0069 bool
0070 , value = (
0071 sizeof(
0072 is_lvalue_iterator_impl<Value>::tester(
0073 BOOST_LVALUE_PRESERVER(*x), 0
0074 )
0075 ) == 1
0076 )
0077 );
0078 };
0079 };
0080
0081 #undef BOOST_LVALUE_PRESERVER
0082
0083
0084
0085
0086 template <>
0087 struct is_lvalue_iterator_impl<void>
0088 {
0089 template <class It>
0090 struct rebind : boost::mpl::false_
0091 {};
0092 };
0093
0094 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
0095 template <>
0096 struct is_lvalue_iterator_impl<const void>
0097 {
0098 template <class It>
0099 struct rebind : boost::mpl::false_
0100 {};
0101 };
0102
0103 template <>
0104 struct is_lvalue_iterator_impl<volatile void>
0105 {
0106 template <class It>
0107 struct rebind : boost::mpl::false_
0108 {};
0109 };
0110
0111 template <>
0112 struct is_lvalue_iterator_impl<const volatile void>
0113 {
0114 template <class It>
0115 struct rebind : boost::mpl::false_
0116 {};
0117 };
0118 #endif
0119
0120
0121
0122
0123
0124 template <class It>
0125 struct is_readable_lvalue_iterator_impl
0126 : is_lvalue_iterator_impl<
0127 BOOST_DEDUCED_TYPENAME std::iterator_traits<It>::value_type const
0128 >::template rebind<It>
0129 {};
0130
0131 template <class It>
0132 struct is_non_const_lvalue_iterator_impl
0133 : is_lvalue_iterator_impl<
0134 BOOST_DEDUCED_TYPENAME std::iterator_traits<It>::value_type
0135 >::template rebind<It>
0136 {};
0137 }
0138
0139 template< typename T > struct is_lvalue_iterator
0140 : public ::boost::integral_constant<bool,::boost::iterators::detail::is_readable_lvalue_iterator_impl<T>::value>
0141 {
0142 public:
0143 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_lvalue_iterator,(T))
0144 };
0145
0146 template< typename T > struct is_non_const_lvalue_iterator
0147 : public ::boost::integral_constant<bool,::boost::iterators::detail::is_non_const_lvalue_iterator_impl<T>::value>
0148 {
0149 public:
0150 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_non_const_lvalue_iterator,(T))
0151 };
0152
0153 }
0154
0155 using iterators::is_lvalue_iterator;
0156 using iterators::is_non_const_lvalue_iterator;
0157
0158 }
0159
0160 #endif
0161
0162 #include <boost/iterator/detail/config_undef.hpp>
0163
0164 #endif