1 // Copyright David Abrahams 2003. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 #ifndef IS_READABLE_ITERATOR_DWA2003112_HPP
5 # define IS_READABLE_ITERATOR_DWA2003112_HPP
7 #include <boost/mpl/bool.hpp>
8 #include <boost/detail/iterator.hpp>
10 #include <boost/type_traits/detail/bool_trait_def.hpp>
11 #include <boost/iterator/detail/any_conversion_eater.hpp>
13 // should be the last #include
14 #include <boost/iterator/detail/config_def.hpp>
16 #ifndef BOOST_NO_IS_CONVERTIBLE
22 // Guts of is_readable_iterator. Value is the iterator's value_type
23 // and the result is computed in the nested rebind template.
24 template <class Value
>
25 struct is_readable_iterator_impl
27 static char tester(Value
&, int);
28 static char (& tester(any_conversion_eater
, ...) )[2];
35 BOOST_STATIC_CONSTANT(
39 is_readable_iterator_impl
<Value
>::tester(*x
, 1)
46 #undef BOOST_READABLE_PRESERVER
49 // void specializations to handle std input and output iterators
52 struct is_readable_iterator_impl
<void>
55 struct rebind
: boost::mpl::false_
59 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
61 struct is_readable_iterator_impl
<const void>
64 struct rebind
: boost::mpl::false_
69 struct is_readable_iterator_impl
<volatile void>
72 struct rebind
: boost::mpl::false_
77 struct is_readable_iterator_impl
<const volatile void>
80 struct rebind
: boost::mpl::false_
86 // This level of dispatching is required for Borland. We might save
87 // an instantiation by removing it for others.
90 struct is_readable_iterator_impl2
91 : is_readable_iterator_impl
<
92 BOOST_DEDUCED_TYPENAME
boost::detail::iterator_traits
<It
>::value_type
const
93 >::template rebind
<It
>
97 // Define the trait with full mpl lambda capability and various broken
98 // compiler workarounds
99 BOOST_TT_AUX_BOOL_TRAIT_DEF1(
100 is_readable_iterator
,T
,::boost::detail::is_readable_iterator_impl2
<T
>::value
)
106 #include <boost/iterator/detail/config_undef.hpp>
108 #endif // IS_READABLE_ITERATOR_DWA2003112_HPP