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