forked from boostorg/type_traits
Updated tests to stress new is_convertible and is_base_and_derived improvements.
Updated docs accordingly. [SVN r17147]
This commit is contained in:
@ -4,16 +4,23 @@
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
|
||||
#include "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#include TYPE_TRAITS(is_base_and_derived)
|
||||
|
||||
|
||||
|
||||
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), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Base,Base>::value), true);
|
||||
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<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);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Derived2,MultiBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Base,PrivateBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<NonDerived,Base>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Base,void>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived<Base,const void>::value), false);
|
||||
@ -34,3 +41,4 @@ TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -49,6 +49,8 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int&, const int&>::value), t
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int[2], int*>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int[2], const int*>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<const int[2], int*>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int*, int[3]>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<test_abc3, const test_abc1&>::value), true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<non_pointer, void*>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<non_pointer, int*>::value), false);
|
||||
@ -60,7 +62,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int_constructible, test_abc1
|
||||
|
||||
//
|
||||
// the following tests all involve user defined conversions which do
|
||||
// not compile with Borland C++ Builder:
|
||||
// not compile with Borland C++ Builder 5:
|
||||
//
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int, int_constructible>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<float> >::value), true);
|
||||
|
@ -180,6 +180,9 @@ union empty_POD_union_UDT{};
|
||||
class Base { };
|
||||
|
||||
class Derived : public Base { };
|
||||
class Derived2 : public Base { };
|
||||
class MultiBase : public Derived, public Derived2 {};
|
||||
class PrivateBase : private Base {};
|
||||
|
||||
class NonDerived { };
|
||||
|
||||
|
Reference in New Issue
Block a user