]> git.lyx.org Git - lyx.git/blob - boost/boost/iterator/interoperable.hpp
Boost 1.31.0
[lyx.git] / boost / boost / iterator / interoperable.hpp
1 // (C) Copyright David Abrahams 2002.
2 // (C) Copyright Jeremy Siek    2002.
3 // (C) Copyright Thomas Witt    2002.
4 // Permission to copy, use, modify,
5 // sell and distribute this software is granted provided this
6 // copyright notice appears in all copies. This software is provided
7 // "as is" without express or implied warranty, and with no claim as
8 // to its suitability for any purpose.
9 #ifndef BOOST_INTEROPERABLE_23022003THW_HPP
10 # define BOOST_INTEROPERABLE_23022003THW_HPP
11
12 # include <boost/mpl/bool.hpp>
13 # include <boost/mpl/or.hpp>
14
15 # include <boost/type_traits/is_convertible.hpp>
16
17 # include <boost/iterator/detail/config_def.hpp> // must appear last
18
19 namespace boost
20 {
21
22   //
23   // Meta function that determines whether two
24   // iterator types are considered interoperable.
25   //
26   // Two iterator types A,B are considered interoperable if either
27   // A is convertible to B or vice versa.
28   // This interoperability definition is in sync with the
29   // standards requirements on constant/mutable container
30   // iterators (23.1 [lib.container.requirements]).
31   //
32   // For compilers that don't support is_convertible 
33   // is_interoperable gives false positives. See comments
34   // on operator implementation for consequences.
35   //
36   template <typename A, typename B>
37   struct is_interoperable
38 # ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
39     : mpl::true_
40 # else
41     : mpl::or_<
42           is_convertible< A, B >
43         , is_convertible< B, A > >
44 # endif
45   { 
46   };
47
48 } // namespace boost
49
50 # include <boost/iterator/detail/config_undef.hpp>
51
52 #endif // BOOST_INTEROPERABLE_23022003THW_HPP