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