// Copyright 2000 John Maddock (john@johnmaddock.co.uk)
// Copyright 2000 Jeremy Siek (jsiek@lsc.nd.edu)
-// Copyright 1999, 2000 Jaakko J\84rvi (jaakko.jarvi@cs.utu.fi)
+// Copyright 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
//
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
#ifndef BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED
#define BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED
+#include <boost/type_traits/intrinsics.hpp>
+#ifndef BOOST_IS_CONVERTIBLE
#include <boost/type_traits/detail/yes_no_type.hpp>
#include <boost/type_traits/config.hpp>
#include <boost/type_traits/is_array.hpp>
#ifndef BOOST_NO_IS_ABSTRACT
#include <boost/type_traits/is_abstract.hpp>
#endif
+#include <boost/type_traits/add_rvalue_reference.hpp>
#if defined(__MWERKS__)
#include <boost/type_traits/is_function.hpp>
#include <boost/type_traits/remove_reference.hpp>
#endif
+#endif // BOOST_IS_CONVERTIBLE
+
// should be always the last #include directive
#include <boost/type_traits/detail/bool_trait_def.hpp>
namespace boost {
+#ifndef BOOST_IS_CONVERTIBLE
+
// is one type convertable to another?
//
// there are multiple versions of the is_convertible
{
static no_type BOOST_TT_DECL _m_check(...);
static yes_type BOOST_TT_DECL _m_check(To);
- static From _m_from;
+ static typename add_rvalue_reference<From>::type _m_from;
enum { value = sizeof( _m_check(_m_from) ) == sizeof(yes_type) };
};
};
template <typename From, typename To>
struct is_convertible_basic_impl
- : does_conversion_exist<From>::template result_<To>
+ : public does_conversion_exist<From>::template result_<To>
{
};
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(T);
};
- static From _m_from;
+ static typename add_rvalue_reference<From>::type _m_from;
static bool const value = sizeof( checker<To>::_m_check(_m_from) )
== sizeof(::boost::type_traits::yes_type);
#pragma option pop
template <typename From, typename To>
struct is_convertible_basic_impl
{
- static From _m_from;
- static bool const value = sizeof( detail::checker<To>::_m_check(_m_from, 0) )
+ static typename add_rvalue_reference<From>::type _m_from;
+ static bool const value = sizeof( boost::detail::checker<To>::_m_check(_m_from, 0) )
== sizeof(::boost::type_traits::yes_type);
};
{
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion ...);
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int);
- static From _m_from;
+ static typename add_rvalue_reference<From>::type _m_from;
BOOST_STATIC_CONSTANT(bool, value =
sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type)
template <class T>
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion, float, T);
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int, int);
- static From _m_from;
+ static typename add_rvalue_reference<From>::type _m_from;
// Static constants sometime cause the conversion of _m_from to To to be
// called. This doesn't happen with an enum.
{
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion ...);
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int);
- static From _m_from;
+ static typename add_rvalue_reference<From>::type _m_from;
BOOST_STATIC_CONSTANT(bool, value =
sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type)
{
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...);
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To);
- static From _m_from;
+ static typename add_rvalue_reference<From>::type _m_from;
BOOST_STATIC_CONSTANT(bool, value =
sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type)
);
{
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...);
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To);
- static From _m_from;
+ static typename add_rvalue_reference<From>::type _m_from;
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4244)
+#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
+#pragma warning(disable:6334)
+#endif
#endif
BOOST_STATIC_CONSTANT(bool, value =
sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type)
template <typename From, typename To>
struct is_convertible_impl_dispatch_base
{
-#ifndef __HP_aCC
+#if !BOOST_WORKAROUND(__HP_aCC, < 60700)
typedef is_convertible_impl_select<
::boost::is_arithmetic<From>::value,
::boost::is_arithmetic<To>::value,
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void,To,false)
-BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,true)
+BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,false)
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const,To,false)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void volatile,To,false)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const volatile,To,false)
-BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,true)
-BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,true)
-BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,true)
+BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,false)
+BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,false)
+BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,false)
#endif
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_impl_dispatch<From,To>::value))
+#else
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,BOOST_IS_CONVERTIBLE(From,To))
+
+#endif
+
} // namespace boost
#include <boost/type_traits/detail/bool_trait_undef.hpp>