forked from boostorg/type_traits
Added true_type and false_type to aid user-defined specialisations.
[SVN r21269]
This commit is contained in:
@@ -84,8 +84,10 @@ test-suite type_traits :
|
||||
[ type-traits-run tricky_is_enum_test.cpp ]
|
||||
[ type-traits-run tricky_partial_spec_test.cpp ]
|
||||
[ type-traits-run type_with_alignment_test.cpp ]
|
||||
[ type-traits-run udt_specialisations.cpp ]
|
||||
|
||||
; # type traits suite
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
#include "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_pod.hpp>
|
||||
# include <boost/type_traits/is_class.hpp>
|
||||
# include <boost/type_traits/is_union.hpp>
|
||||
#endif
|
||||
|
||||
struct my_pod{};
|
||||
struct my_union
|
||||
{
|
||||
char c;
|
||||
int i;
|
||||
};
|
||||
|
||||
namespace tt
|
||||
{
|
||||
template<>
|
||||
struct is_pod<my_pod>
|
||||
: public true_type{};
|
||||
template<>
|
||||
struct is_pod<my_union>
|
||||
: public true_type{};
|
||||
template<>
|
||||
struct is_union<my_union>
|
||||
: public true_type{};
|
||||
template<>
|
||||
struct is_class<my_union>
|
||||
: public false_type{};
|
||||
}
|
||||
|
||||
TT_TEST_BEGIN(is_pod)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<my_pod>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<my_union>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_union<my_union>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_class<my_union>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
Reference in New Issue
Block a user