source: NonGTP/Boost/boost/python/detail/convertible.hpp @ 857

Revision 857, 1.2 KB checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright David Abrahams 2002.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5#ifndef CONVERTIBLE_DWA2002614_HPP
6# define CONVERTIBLE_DWA2002614_HPP
7
8# if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 241
9#  include <boost/mpl/if.hpp>
10#  include <boost/type_traits/conversion_traits.hpp>
11# endif
12
13// Supplies a runtime is_convertible check which can be used with tag
14// dispatching to work around the Metrowerks Pro7 limitation with boost::is_convertible
15namespace boost { namespace python { namespace detail {
16
17typedef char* yes_convertible;
18typedef int* no_convertible;
19
20template <class Target>
21struct convertible
22{
23# if !defined(__EDG_VERSION__) || __EDG_VERSION__ > 241 || __EDG_VERSION__ == 238
24    static inline no_convertible check(...) { return 0; }
25    static inline yes_convertible check(Target) { return 0; }
26# else
27    template <class X>
28    static inline typename mpl::if_c<
29        is_convertible<X,Target>::value
30        , yes_convertible
31        , no_convertible
32        >::type check(X const&) { return 0; }
33# endif
34};
35
36}}} // namespace boost::python::detail
37
38#endif // CONVERTIBLE_DWA2002614_HPP
Note: See TracBrowser for help on using the repository browser.