Merge interlinked changes in config, type_traits and TR1 libraries.

[SVN r56678]
This commit is contained in:
John Maddock
2009-10-09 16:16:02 +00:00
parent f618d007b4
commit aff3d68580
17 changed files with 127 additions and 26 deletions

View File

@ -85,7 +85,7 @@ namespace detail {
BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl<T>::template check_sig<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(has_new_operator_impl<T>::template check_sig2<T>(0)));
#else
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(push)
#pragma warning(disable:6334)
#endif
@ -93,7 +93,7 @@ namespace detail {
BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(check_sig2<T>(0)));
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(pop)
#endif
#endif

View File

@ -82,7 +82,7 @@
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#endif
#if defined(BOOST_MSVC) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >=140050215)
#if defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215)
# include <boost/type_traits/is_same.hpp>
# define BOOST_IS_UNION(T) __is_union(T)

View File

@ -94,12 +94,12 @@ struct is_abstract_imp2
#ifdef __GNUC__
BOOST_STATIC_CONSTANT(std::size_t, s1 = sizeof(is_abstract_imp2<T>::template check_sig<T>(0)));
#else
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(push)
#pragma warning(disable:6334)
#endif
BOOST_STATIC_CONSTANT(std::size_t, s1 = sizeof(check_sig<T>(0)));
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(pop)
#endif
#endif

View File

@ -15,10 +15,10 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/detail/ice_and.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/config.hpp>
#include <boost/static_assert.hpp>
#endif
#include <boost/type_traits/remove_cv.hpp>
// should be the last #include
#include <boost/type_traits/detail/bool_trait_def.hpp>
@ -133,7 +133,7 @@ struct bd_helper
template<typename B, typename D>
struct is_base_and_derived_impl2
{
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(push)
#pragma warning(disable:6334)
#endif
@ -156,7 +156,7 @@ struct is_base_and_derived_impl2
BOOST_STATIC_CONSTANT(bool, value =
sizeof(bd_helper<B,D>::check_sig(Host(), 0)) == sizeof(type_traits::yes_type));
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(pop)
#endif
};
@ -212,7 +212,7 @@ struct is_base_and_derived_impl
typedef is_base_and_derived_select<
::boost::is_class<B>::value,
::boost::is_class<D>::value,
::boost::is_same<B,D>::value> selector;
::boost::is_same<ncvB,ncvD>::value> selector;
typedef typename selector::template rebind<ncvB,ncvD> binder;
typedef typename binder::type bound_type;
@ -222,7 +222,10 @@ struct is_base_and_derived_impl
template <typename B, typename D>
struct is_base_and_derived_impl
{
BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_BASE_OF(B,D));
typedef typename remove_cv<B>::type ncvB;
typedef typename remove_cv<D>::type ncvD;
BOOST_STATIC_CONSTANT(bool, value = (BOOST_IS_BASE_OF(B,D) && ! ::boost::is_same<ncvB,ncvD>::value));
};
#endif
} // namespace detail

19
include/boost/type_traits/is_base_of.hpp Executable file → Normal file
View File

@ -11,21 +11,32 @@
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/detail/ice_or.hpp>
#include <boost/type_traits/detail/ice_and.hpp>
// should be the last #include
#include <boost/type_traits/detail/bool_trait_def.hpp>
namespace boost {
namespace detail{
template <class B, class D>
struct is_base_of_imp
{
typedef typename remove_cv<B>::type ncvB;
typedef typename remove_cv<D>::type ncvD;
BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or<
(::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value),
(::boost::type_traits::ice_and< ::boost::is_same<ncvB,ncvD>::value, ::boost::is_class<ncvB>::value>::value)>::value));
};
}
BOOST_TT_AUX_BOOL_TRAIT_DEF2(
is_base_of
, Base
, Derived
, (::boost::type_traits::ice_or<
(::boost::detail::is_base_and_derived_impl<Base,Derived>::value),
(::boost::is_same<Base,Derived>::value)>::value)
)
, (::boost::detail::is_base_of_imp<Base, Derived>::value))
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false)

View File

@ -0,0 +1,50 @@
// (C) Copyright Rani Sharoni 2003-2005.
// 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.
#ifndef BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED
#define BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/detail/ice_or.hpp>
// should be the last #include
#include <boost/type_traits/detail/bool_trait_def.hpp>
namespace boost { namespace tr1{
namespace detail{
template <class B, class D>
struct is_base_of_imp
{
typedef typename remove_cv<B>::type ncvB;
typedef typename remove_cv<D>::type ncvD;
BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or<
(::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value),
(::boost::is_same<ncvB,ncvD>::value)>::value));
};
}
BOOST_TT_AUX_BOOL_TRAIT_DEF2(
is_base_of
, Base
, Derived
, (::boost::tr1::detail::is_base_of_imp<Base, Derived>::value))
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false)
#endif
} } // namespace boost
#include <boost/type_traits/detail/bool_trait_undef.hpp>
#endif // BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED

View File

@ -256,7 +256,7 @@ struct is_convertible_basic_impl
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4244)
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(disable:6334)
#endif
#endif

View File

@ -65,7 +65,7 @@ struct is_function_impl
template <typename T>
struct is_function_impl
{
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(push)
#pragma warning(disable:6334)
#endif
@ -74,7 +74,7 @@ struct is_function_impl
bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t))
== sizeof(::boost::type_traits::yes_type)
);
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(pop)
#endif
};

View File

@ -64,7 +64,7 @@ struct is_mem_fun_pointer_select<false>
{
template <typename T> struct result_
{
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(push)
#pragma warning(disable:6334)
#endif
@ -75,7 +75,7 @@ struct is_mem_fun_pointer_select<false>
bool, value = (
1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(self_type::make_t))
));
#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(pop)
#endif
};

View File

@ -50,7 +50,7 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::boost::is_member_function_pointer<T>::value)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true)
#if !BOOST_WORKAROUND(__MWERKS__,<=0x3003)
#if !BOOST_WORKAROUND(__MWERKS__,<=0x3003) && !BOOST_WORKAROUND(__IBMCPP__, <=600)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const,true)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*volatile,true)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const volatile,true)

View File

@ -30,7 +30,7 @@ template <class T>
struct is_signed_helper
{
typedef typename remove_cv<T>::type no_cv_t;
BOOST_STATIC_CONSTANT(bool, value = (static_cast<no_cv_t>(-1) < 0));
BOOST_STATIC_CONSTANT(bool, value = (!(static_cast<no_cv_t>(-1) > 0)));
};
template <bool integral_type>

View File

@ -42,14 +42,14 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
X();
X(const X&);
X& operator=(const X&);
~X();
~X()throw();
};
struct Y : public virtual Derived
{
Y();
Y(const Y&);
Y& operator=(const Y&);
~Y();
~Y()throw();
};
#else
struct X : Derived, virtual Base
@ -57,14 +57,14 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
X();
X(const X&);
X& operator=(const X&);
~X();
~X()throw();
};
struct Y : Derived
{
Y();
Y(const Y&);
Y& operator=(const Y&);
~Y();
~Y()throw();
};
#endif
BOOST_STATIC_CONSTANT(bool, value = (sizeof(X)==sizeof(Y)));

View File

@ -30,6 +30,7 @@ TT_TEST_BEGIN(is_base_and_derived)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Derived,Base>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Derived,Derived>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Base,Base>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<const Base,Base>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Base,Derived>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Base,MultiBase>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Derived,MultiBase>::value), true);
@ -40,8 +41,13 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Base,void>::value), fal
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Base,const void>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<void,Derived>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<const void,Derived>::value), false);
#if defined(TEST_STD) && (TEST_STD < 2006)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<int, int>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<const int, int>::value), true);
#else
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<int, int>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<const int, int>::value), false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<VB,VD>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<VD,VB>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<test_abc1,test_abc3>::value), true);

View File

@ -19,8 +19,11 @@ TT_TEST_BEGIN(is_base_of)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,Base>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,Derived>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,const Derived>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,Base>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,Derived>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<const Base,Derived>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,const Derived>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,MultiBase>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,MultiBase>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived2,MultiBase>::value), true);
@ -30,8 +33,13 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,void>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,const void>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<void,Derived>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<const void,Derived>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<int, int>::value), true); // really it is!!!!!
#if defined(TEST_STD) && (TEST_STD < 2006)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<int, int>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<const int, int>::value), true);
#else
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<int, int>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<const int, int>::value), false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<VB,VD>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<VD,VB>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<test_abc1,test_abc3>::value), true);

View File

@ -9,6 +9,21 @@
#include "check_integral_constant.hpp"
#include <boost/type_traits/is_virtual_base_of.hpp>
// for bug report 3317: https://svn.boost.org/trac/boost/ticket/3317
class B
{
public:
B();
virtual ~B()throw();
};
class D : public B
{
public:
D();
virtual ~D()throw();
};
TT_TEST_BEGIN(is_virtual_base_of)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<Derived,Base>::value), false);
@ -42,6 +57,9 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<boost::noncopyable,virtu
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<virtual_inherit4,boost::noncopyable>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<int_convertible,virtual_inherit5>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<virtual_inherit5,int_convertible>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<Base,virtual_inherit6>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<virtual_inherit6,Base>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<B,D>::value), false);
TT_TEST_END

View File

@ -370,6 +370,7 @@ struct virtual_inherit2 : virtual_inherit1 { };
struct virtual_inherit3 : private virtual Base {};
struct virtual_inherit4 : virtual boost::noncopyable {};
struct virtual_inherit5 : virtual int_convertible {};
struct virtual_inherit6 : virtual Base { virtual ~virtual_inherit6()throw(); };
typedef void foo0_t();
typedef void foo1_t(int);

View File

@ -39,7 +39,11 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<foo0_t>::value, fals
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<foo0_t>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<foo0_t>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<foo0_t>::value, false);
#if defined(TEST_STD) && (TEST_STD < 2006)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<foo0_t, foo0_t>::value), true); // TR1 required behaviour (new to 1.34)
#else
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<foo0_t, foo0_t>::value), false); // C++0x required behaviour (new to 1.40)
#endif
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<foo0_t, int>::value), false);