Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:55

0001 // Copyright David Abrahams 2003. Use, modification and distribution is
0002 // subject to the Boost Software License, Version 1.0. (See accompanying
0003 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0004 #ifndef IS_READABLE_ITERATOR_DWA2003112_HPP
0005 # define IS_READABLE_ITERATOR_DWA2003112_HPP
0006 
0007 #include <boost/mpl/bool.hpp>
0008 #include <boost/mpl/aux_/lambda_support.hpp>
0009 #include <boost/type_traits/add_lvalue_reference.hpp>
0010 
0011 #include <boost/iterator/detail/any_conversion_eater.hpp>
0012 
0013 #include <iterator>
0014 
0015 // should be the last #include
0016 #include <boost/type_traits/integral_constant.hpp>
0017 #include <boost/iterator/detail/config_def.hpp>
0018 
0019 #ifndef BOOST_NO_IS_CONVERTIBLE
0020 
0021 namespace boost {
0022 
0023 namespace iterators {
0024 
0025 namespace detail
0026 {
0027   // Guts of is_readable_iterator.  Value is the iterator's value_type
0028   // and the result is computed in the nested rebind template.
0029   template <class Value>
0030   struct is_readable_iterator_impl
0031   {
0032       static char tester(typename add_lvalue_reference<Value>::type, int);
0033       static char (& tester(any_conversion_eater, ...) )[2];
0034 
0035       template <class It>
0036       struct rebind
0037       {
0038           static It& x;
0039 
0040           BOOST_STATIC_CONSTANT(
0041               bool
0042             , value = (
0043                 sizeof(
0044                     is_readable_iterator_impl<Value>::tester(*x, 1)
0045                 ) == 1
0046             )
0047           );
0048       };
0049   };
0050 
0051 #undef BOOST_READABLE_PRESERVER
0052 
0053   //
0054   // void specializations to handle std input and output iterators
0055   //
0056   template <>
0057   struct is_readable_iterator_impl<void>
0058   {
0059       template <class It>
0060       struct rebind : boost::mpl::false_
0061       {};
0062   };
0063 
0064 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
0065   template <>
0066   struct is_readable_iterator_impl<const void>
0067   {
0068       template <class It>
0069       struct rebind : boost::mpl::false_
0070       {};
0071   };
0072 
0073   template <>
0074   struct is_readable_iterator_impl<volatile void>
0075   {
0076       template <class It>
0077       struct rebind : boost::mpl::false_
0078       {};
0079   };
0080 
0081   template <>
0082   struct is_readable_iterator_impl<const volatile void>
0083   {
0084       template <class It>
0085       struct rebind : boost::mpl::false_
0086       {};
0087   };
0088 #endif
0089 
0090   //
0091   // This level of dispatching is required for Borland.  We might save
0092   // an instantiation by removing it for others.
0093   //
0094   template <class It>
0095   struct is_readable_iterator_impl2
0096     : is_readable_iterator_impl<
0097           BOOST_DEDUCED_TYPENAME std::iterator_traits<It>::value_type const
0098       >::template rebind<It>
0099   {};
0100 } // namespace detail
0101 
0102 template< typename T > struct is_readable_iterator
0103 : public ::boost::integral_constant<bool,::boost::iterators::detail::is_readable_iterator_impl2<T>::value>
0104 {
0105 public:
0106     BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_readable_iterator,(T))
0107 };
0108 
0109 } // namespace iterators
0110 
0111 using iterators::is_readable_iterator;
0112 
0113 } // namespace boost
0114 
0115 #endif
0116 
0117 #include <boost/iterator/detail/config_undef.hpp>
0118 
0119 #endif // IS_READABLE_ITERATOR_DWA2003112_HPP