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