Chris@16
|
1 // (C) Copyright David Abrahams 2002.
|
Chris@16
|
2 // (C) Copyright Jeremy Siek 2002.
|
Chris@16
|
3 // (C) Copyright Thomas Witt 2002.
|
Chris@16
|
4 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
5 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
6 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
7 #ifndef BOOST_INTEROPERABLE_23022003THW_HPP
|
Chris@16
|
8 # define BOOST_INTEROPERABLE_23022003THW_HPP
|
Chris@16
|
9
|
Chris@16
|
10 # include <boost/mpl/bool.hpp>
|
Chris@16
|
11 # include <boost/mpl/or.hpp>
|
Chris@16
|
12
|
Chris@16
|
13 # include <boost/type_traits/is_convertible.hpp>
|
Chris@16
|
14
|
Chris@16
|
15 # include <boost/iterator/detail/config_def.hpp> // must appear last
|
Chris@16
|
16
|
Chris@101
|
17 namespace boost {
|
Chris@101
|
18 namespace iterators {
|
Chris@16
|
19
|
Chris@16
|
20 //
|
Chris@16
|
21 // Meta function that determines whether two
|
Chris@16
|
22 // iterator types are considered interoperable.
|
Chris@16
|
23 //
|
Chris@16
|
24 // Two iterator types A,B are considered interoperable if either
|
Chris@16
|
25 // A is convertible to B or vice versa.
|
Chris@16
|
26 // This interoperability definition is in sync with the
|
Chris@16
|
27 // standards requirements on constant/mutable container
|
Chris@16
|
28 // iterators (23.1 [lib.container.requirements]).
|
Chris@16
|
29 //
|
Chris@101
|
30 // For compilers that don't support is_convertible
|
Chris@16
|
31 // is_interoperable gives false positives. See comments
|
Chris@16
|
32 // on operator implementation for consequences.
|
Chris@16
|
33 //
|
Chris@16
|
34 template <typename A, typename B>
|
Chris@16
|
35 struct is_interoperable
|
Chris@16
|
36 # ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
|
Chris@16
|
37 : mpl::true_
|
Chris@16
|
38 # else
|
Chris@16
|
39 : mpl::or_<
|
Chris@16
|
40 is_convertible< A, B >
|
Chris@16
|
41 , is_convertible< B, A > >
|
Chris@16
|
42 # endif
|
Chris@101
|
43 {
|
Chris@16
|
44 };
|
Chris@16
|
45
|
Chris@101
|
46 } // namespace iterators
|
Chris@101
|
47
|
Chris@101
|
48 using iterators::is_interoperable;
|
Chris@101
|
49
|
Chris@16
|
50 } // namespace boost
|
Chris@16
|
51
|
Chris@16
|
52 # include <boost/iterator/detail/config_undef.hpp>
|
Chris@16
|
53
|
Chris@16
|
54 #endif // BOOST_INTEROPERABLE_23022003THW_HPP
|