os/ossrv/ossrv_pub/boost_apis/boost/python/detail/convertible.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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
    15 namespace boost { namespace python { namespace detail { 
    16 
    17 typedef char* yes_convertible;
    18 typedef int* no_convertible;
    19 
    20 template <class Target>
    21 struct 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