diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/stdapis/boost/ptr_container/detail/is_convertible.hpp --- a/epoc32/include/stdapis/boost/ptr_container/detail/is_convertible.hpp Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/stdapis/boost/ptr_container/detail/is_convertible.hpp Wed Mar 31 12:33:34 2010 +0100 @@ -1,416 +1,73 @@ +// (C) Copyright Thorsten Ottosen 2005 +// (C) Copyright Howard Hinnant 2004 +// (C) Copyright Jonathan Turkanis 2004 +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) -// Copyright 2000 John Maddock (john@johnmaddock.co.uk) -// Copyright 2000 Jeremy Siek (jsiek@lsc.nd.edu) -// Copyright 1999, 2000 Jaakko J„rvi (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 -// http://www.boost.org/LICENSE_1_0.txt). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. +// Contains type traits machinery for incomplete arrays. MPL compatibility +// is included for completeness, but is not necessary for the current +// application. +// -#ifndef BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED -#define BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED +#ifndef BOOST_MOVE_PTR_ARRAYS_HPP_INCLUDED +#define BOOST_MOVE_PTR_ARRAYS_HPP_INCLUDED -#include -#include +#include // BOOST_STATIC_CONSTANT. +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#ifndef BOOST_NO_IS_ABSTRACT -#include +#include +#include +#include +#include +#include + +namespace boost { namespace ptr_container_detail { namespace move_ptrs { + +// From Howard Hinnant. +template +struct is_array_convertible { + typedef typename remove_bounds::type t_element; + typedef typename remove_bounds::type u_element; + typedef typename remove_cv::type t_base; + typedef typename remove_cv::type u_base; + typedef typename + mpl::and_< + is_array, + is_array, + is_same, + is_convertible + >::type type; + BOOST_STATIC_CONSTANT(bool, value = type::value); + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, is_array_convertible, (T, U)) +}; + +template +struct is_smart_ptr_convertible + : mpl::if_< + is_array, + is_array_convertible, + is_convertible + >::type + { }; + +#ifndef BOOST_NO_SFINAE + template + struct enable_if_convertible + : enable_if< + is_smart_ptr_convertible, + T + > + { }; +#else + template + struct enable_if_convertible : mpl::identity { }; #endif -#if defined(__MWERKS__) -#include -#include -#endif +} } } // End namespaces ptr_container_detail, move_ptrs, boost. -// should be always the last #include directive -#include - -namespace boost { - -// is one type convertable to another? -// -// there are multiple versions of the is_convertible -// template, almost every compiler seems to require its -// own version. -// -// Thanks to Andrei Alexandrescu for the original version of the -// conversion detection technique! -// - -namespace detail { - -// MS specific version: - -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - -// This workaround is necessary to handle when From is void -// which is normally taken care of by the partial specialization -// of the is_convertible typename. -using ::boost::type_traits::yes_type; -using ::boost::type_traits::no_type; - -template< typename From > -struct does_conversion_exist -{ - template< typename To > struct result_ - { - static no_type BOOST_TT_DECL _m_check(...); - static yes_type BOOST_TT_DECL _m_check(To); - static From _m_from; - enum { value = sizeof( _m_check(_m_from) ) == sizeof(yes_type) }; - }; -}; - -template<> -struct does_conversion_exist -{ - template< typename To > struct result_ - { - enum { value = ::boost::is_void::value }; - }; -}; - -template -struct is_convertible_basic_impl - : does_conversion_exist::template result_ -{ -}; - -#elif defined(__BORLANDC__) && (__BORLANDC__ < 0x560) -// -// special version for Borland compilers -// this version breaks when used for some -// UDT conversions: -// -template -struct is_convertible_impl -{ -#pragma option push -w-8074 - // This workaround for Borland breaks the EDG C++ frontend, - // so we only use it for Borland. - template struct checker - { - static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); - static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(T); - }; - - static From _m_from; - static bool const value = sizeof( checker::_m_check(_m_from) ) - == sizeof(::boost::type_traits::yes_type); -#pragma option pop -}; - -#elif defined(__GNUC__) || defined(__BORLANDC__) && (__BORLANDC__ < 0x600) -// special version for gcc compiler + recent Borland versions -// note that this does not pass UDT's through (...) - -struct any_conversion -{ - template any_conversion(const volatile T&); - template any_conversion(T&); -}; - -template struct checker -{ - static boost::type_traits::no_type _m_check(any_conversion ...); - static boost::type_traits::yes_type _m_check(T, int); -}; - -template -struct is_convertible_basic_impl -{ - static From _m_from; - static bool const value = sizeof( detail::checker::_m_check(_m_from, 0) ) - == sizeof(::boost::type_traits::yes_type); -}; - -#elif (defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 245) && !defined(__ICL)) \ - || defined(__IBMCPP__) || defined(__HP_aCC) -// -// This is *almost* an ideal world implementation as it doesn't rely -// on undefined behaviour by passing UDT's through (...). -// Unfortunately it doesn't quite pass all the tests for most compilers (sigh...) -// Enable this for your compiler if is_convertible_test.cpp will compile it... -// -// Note we do not enable this for VC7.1, because even though it passes all the -// type_traits tests it is known to cause problems when instantiation occurs -// deep within the instantiation tree :-( -// -struct any_conversion -{ - template any_conversion(const volatile T&); - // we need this constructor to catch references to functions - // (which can not be cv-qualified): - template any_conversion(T&); -}; - -template -struct is_convertible_basic_impl -{ - 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; - - BOOST_STATIC_CONSTANT(bool, value = - sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) - ); -}; - -#elif defined(__DMC__) - -struct any_conversion -{ - template any_conversion(const volatile T&); - // we need this constructor to catch references to functions - // (which can not be cv-qualified): - template any_conversion(T&); -}; - -template -struct is_convertible_basic_impl -{ - // Using '...' doesn't always work on Digital Mars. This version seems to. - template - 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 constants sometime cause the conversion of _m_from to To to be - // called. This doesn't happen with an enum. - enum { value = - sizeof( _m_check(_m_from, 0, 0) ) == sizeof(::boost::type_traits::yes_type) - }; -}; - -#elif defined(__MWERKS__) -// -// CW works with the technique implemented above for EDG, except when From -// is a function type (or a reference to such a type), in which case -// any_conversion won't be accepted as a valid conversion. We detect this -// exceptional situation and channel it through an alternative algorithm. -// - -template -struct is_convertible_basic_impl_aux; - -struct any_conversion -{ - template any_conversion(const volatile T&); -}; - -template -struct is_convertible_basic_impl_aux -{ - 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; - - BOOST_STATIC_CONSTANT(bool, value = - sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) - ); -}; - -template -struct is_convertible_basic_impl_aux -{ - 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; - BOOST_STATIC_CONSTANT(bool, value = - sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) - ); -}; - -template -struct is_convertible_basic_impl: - is_convertible_basic_impl_aux< - From,To, - ::boost::is_function::type>::value - > -{}; - -#else - -// -// This version seems to work pretty well for a wide spectrum of compilers, -// however it does rely on undefined behaviour by passing UDT's through (...). -// -template -struct is_convertible_basic_impl -{ - 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; -#ifdef BOOST_MSVC -#pragma warning(push) -#pragma warning(disable:4244) -#endif - BOOST_STATIC_CONSTANT(bool, value = - sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) - ); -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif -}; - -#endif // is_convertible_impl - -#if defined(__DMC__) -// As before, a static constant sometimes causes errors on Digital Mars. -template -struct is_convertible_impl -{ - typedef typename add_reference::type ref_type; - enum { value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_or< - ::boost::detail::is_convertible_basic_impl::value, - ::boost::is_void::value - >::value, - ::boost::type_traits::ice_not< - ::boost::is_array::value - >::value - >::value) }; -}; -#elif !defined(__BORLANDC__) || __BORLANDC__ > 0x551 -template -struct is_convertible_impl -{ - typedef typename add_reference::type ref_type; - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_or< - ::boost::detail::is_convertible_basic_impl::value, - ::boost::is_void::value - >::value, - ::boost::type_traits::ice_not< - ::boost::is_array::value - >::value - >::value) - ); -}; -#endif - -template -struct is_convertible_impl_select -{ - template - struct rebind - { - typedef is_convertible_impl type; - }; -}; - -template <> -struct is_convertible_impl_select -{ - template - struct rebind - { - typedef true_type type; - }; -}; - -template <> -struct is_convertible_impl_select -{ - template - struct rebind - { - typedef false_type type; - }; -}; - -template <> -struct is_convertible_impl_select -{ - template - struct rebind - { - typedef false_type type; - }; -}; - -template -struct is_convertible_impl_dispatch_base -{ -#if !BOOST_WORKAROUND(__HP_aCC, < 60700) - typedef is_convertible_impl_select< - ::boost::is_arithmetic::value, - ::boost::is_arithmetic::value, -#ifndef BOOST_NO_IS_ABSTRACT - ::boost::is_abstract::value -#else - false -#endif - > selector; -#else - typedef is_convertible_impl_select selector; -#endif - typedef typename selector::template rebind isc_binder; - typedef typename isc_binder::type type; -}; - -template -struct is_convertible_impl_dispatch - : public is_convertible_impl_dispatch_base::type -{}; - -// -// Now add the full and partial specialisations -// for void types, these are common to all the -// implementation above: -// -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -# define TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1,spec2,value) \ - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2,value) \ - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2 const,value) \ - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2 volatile,value) \ - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2 const volatile,value) \ - /**/ - -# define TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2(trait,spec1,spec2,value) \ - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1,spec2,value) \ - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1 const,spec2,value) \ - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1 volatile,spec2,value) \ - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1 const volatile,spec2,value) \ - /**/ - - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2(is_convertible,void,void,true) - -# undef TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2 -# undef TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1 - -#else - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(is_convertible,void,void,true) -#endif // BOOST_NO_CV_VOID_SPECIALIZATIONS - -#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) -#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) -#endif -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_impl_dispatch::value)) - -} // namespace boost - -#include - -#endif // BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED - +#endif // #ifndef BOOST_MOVE_PTR_ARRAYS_HPP_INCLUDED