Chris@16: // Copyright David Abrahams 2003. Use, modification and distribution is Chris@16: // subject to the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: #ifndef IS_READABLE_ITERATOR_DWA2003112_HPP Chris@16: # define IS_READABLE_ITERATOR_DWA2003112_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: // should be the last #include Chris@16: #include Chris@16: Chris@16: #ifndef BOOST_NO_IS_CONVERTIBLE Chris@16: Chris@16: namespace boost { Chris@101: Chris@101: namespace iterators { Chris@101: Chris@16: namespace detail Chris@16: { Chris@16: // Guts of is_readable_iterator. Value is the iterator's value_type Chris@16: // and the result is computed in the nested rebind template. Chris@16: template Chris@16: struct is_readable_iterator_impl Chris@16: { Chris@16: static char tester(Value&, int); Chris@16: static char (& tester(any_conversion_eater, ...) )[2]; Chris@101: Chris@16: template Chris@16: struct rebind Chris@16: { Chris@16: static It& x; Chris@101: Chris@16: BOOST_STATIC_CONSTANT( Chris@16: bool Chris@16: , value = ( Chris@16: sizeof( Chris@16: is_readable_iterator_impl::tester(*x, 1) Chris@16: ) == 1 Chris@16: ) Chris@16: ); Chris@16: }; Chris@16: }; Chris@16: Chris@16: #undef BOOST_READABLE_PRESERVER Chris@101: Chris@16: // Chris@16: // void specializations to handle std input and output iterators Chris@16: // Chris@16: template <> Chris@16: struct is_readable_iterator_impl Chris@16: { Chris@16: template Chris@16: struct rebind : boost::mpl::false_ Chris@16: {}; Chris@16: }; Chris@16: Chris@16: #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS Chris@16: template <> Chris@16: struct is_readable_iterator_impl Chris@16: { Chris@16: template Chris@16: struct rebind : boost::mpl::false_ Chris@16: {}; Chris@16: }; Chris@16: Chris@16: template <> Chris@16: struct is_readable_iterator_impl Chris@16: { Chris@16: template Chris@16: struct rebind : boost::mpl::false_ Chris@16: {}; Chris@16: }; Chris@16: Chris@16: template <> Chris@16: struct is_readable_iterator_impl Chris@16: { Chris@16: template Chris@16: struct rebind : boost::mpl::false_ Chris@16: {}; Chris@16: }; Chris@16: #endif Chris@16: Chris@16: // Chris@16: // This level of dispatching is required for Borland. We might save Chris@16: // an instantiation by removing it for others. Chris@16: // Chris@16: template Chris@16: struct is_readable_iterator_impl2 Chris@16: : is_readable_iterator_impl< Chris@16: BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::value_type const Chris@16: >::template rebind Chris@16: {}; Chris@16: } // namespace detail Chris@16: Chris@16: // Define the trait with full mpl lambda capability and various broken Chris@16: // compiler workarounds Chris@16: BOOST_TT_AUX_BOOL_TRAIT_DEF1( Chris@101: is_readable_iterator,T,::boost::iterators::detail::is_readable_iterator_impl2::value) Chris@101: Chris@101: } // namespace iterators Chris@101: Chris@101: using iterators::is_readable_iterator; Chris@101: Chris@16: } // namespace boost Chris@16: Chris@16: #endif Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // IS_READABLE_ITERATOR_DWA2003112_HPP