forked from boostorg/type_traits
Fixed is_polymorphic for cv-qualified class types
[SVN r16339]
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
#define BOOST_TT_IS_POLYMORPHIC_HPP
|
||||
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
// should be the last #include
|
||||
#include "boost/type_traits/detail/bool_trait_def.hpp"
|
||||
|
||||
@ -16,13 +17,14 @@ namespace detail{
|
||||
template <class T>
|
||||
struct is_polymorphic_imp1
|
||||
{
|
||||
struct d1 : public T
|
||||
typedef remove_cv<T>::type ncvT;
|
||||
struct d1 : public ncvT
|
||||
{
|
||||
d1();
|
||||
~d1()throw();
|
||||
char padding[256];
|
||||
};
|
||||
struct d2 : public T
|
||||
struct d2 : public ncvT
|
||||
{
|
||||
d2();
|
||||
virtual ~d2()throw();
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include TYPE_TRAITS(is_base_and_derived)
|
||||
#include TYPE_COMPARE(is_same)
|
||||
#include TYPE_COMPARE(is_convertible)
|
||||
#include TYPE_TRAITS(is_polymorphic)
|
||||
|
||||
//
|
||||
// VC++ emits an awful lot of warnings unless we define these:
|
||||
@ -59,6 +60,18 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same<test_abc1, const test_abc1>::value)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<void,float>::value), false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<const UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<volatile empty_UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<const VB>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<const volatile VD>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<const test_abc1>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<volatile test_abc2>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<const std::exception>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<const std::bad_alloc>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<const std::runtime_error>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<const std::out_of_range>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic<const std::range_error>::value, true);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user