]> git.lyx.org Git - lyx.git/blob - boost/boost/iterator/is_readable_iterator.hpp
update to boost 1.39: add new files
[lyx.git] / boost / boost / iterator / is_readable_iterator.hpp
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
6 \r
7 #include <boost/mpl/bool.hpp>\r
8 #include <boost/detail/iterator.hpp>\r
9 \r
10 #include <boost/type_traits/detail/bool_trait_def.hpp>\r
11 #include <boost/iterator/detail/any_conversion_eater.hpp>\r
12 \r
13 // should be the last #include\r
14 #include <boost/iterator/detail/config_def.hpp>\r
15 \r
16 #ifndef BOOST_NO_IS_CONVERTIBLE\r
17 \r
18 namespace boost {\r
19  \r
20 namespace detail\r
21 {\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
26   {\r
27       static char tester(Value&, int);\r
28       static char (& tester(any_conversion_eater, ...) )[2];\r
29     \r
30       template <class It>\r
31       struct rebind\r
32       {\r
33           static It& x;\r
34           \r
35           BOOST_STATIC_CONSTANT(\r
36               bool\r
37             , value = (\r
38                 sizeof(\r
39                     is_readable_iterator_impl<Value>::tester(*x, 1)\r
40                 ) == 1\r
41             )\r
42           );\r
43       };\r
44   };\r
45 \r
46 #undef BOOST_READABLE_PRESERVER\r
47   \r
48   //\r
49   // void specializations to handle std input and output iterators\r
50   //\r
51   template <>\r
52   struct is_readable_iterator_impl<void>\r
53   {\r
54       template <class It>\r
55       struct rebind : boost::mpl::false_\r
56       {};\r
57   };\r
58 \r
59 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS\r
60   template <>\r
61   struct is_readable_iterator_impl<const void>\r
62   {\r
63       template <class It>\r
64       struct rebind : boost::mpl::false_\r
65       {};\r
66   };\r
67 \r
68   template <>\r
69   struct is_readable_iterator_impl<volatile void>\r
70   {\r
71       template <class It>\r
72       struct rebind : boost::mpl::false_\r
73       {};\r
74   };\r
75 \r
76   template <>\r
77   struct is_readable_iterator_impl<const volatile void>\r
78   {\r
79       template <class It>\r
80       struct rebind : boost::mpl::false_\r
81       {};\r
82   };\r
83 #endif\r
84 \r
85   //\r
86   // This level of dispatching is required for Borland.  We might save\r
87   // an instantiation by removing it for others.\r
88   //\r
89   template <class It>\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
94   {};\r
95 } // namespace detail\r
96 \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
101     \r
102 } // namespace boost\r
103 \r
104 #endif\r
105 \r
106 #include <boost/iterator/detail/config_undef.hpp>\r
107 \r
108 #endif // IS_READABLE_ITERATOR_DWA2003112_HPP\r