From 77c0127cc6d428641f31f6189cc9d549726841c4 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 19 Jan 2002 13:00:45 +0000 Subject: [PATCH] Fixed is_base_and_derived to work correctly with non-class types. Moved to object_traits.hpp from conversion_traits.hpp [SVN r12353] --- .../boost/type_traits/conversion_traits.hpp | 38 ++----------------- include/boost/type_traits/object_traits.hpp | 30 +++++++++++++++ 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/include/boost/type_traits/conversion_traits.hpp b/include/boost/type_traits/conversion_traits.hpp index 53eeccb..486bc72 100644 --- a/include/boost/type_traits/conversion_traits.hpp +++ b/include/boost/type_traits/conversion_traits.hpp @@ -25,6 +25,9 @@ #ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP #include #endif +#ifndef BOOST_SAME_TRAITS_HPP +#include +#endif // // is one type convertable to another? // @@ -230,41 +233,6 @@ struct is_convertible #endif // is_convertible -template -struct is_base_and_derived -{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::is_convertible::value, - ::boost::type_traits::ice_not< - ::boost::is_void::value - >::value - >::value) - ); -}; - -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -struct is_base_and_derived -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -template -struct is_base_and_derived -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -template -struct is_base_and_derived -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -template -struct is_base_and_derived -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -#endif } // namespace boost diff --git a/include/boost/type_traits/object_traits.hpp b/include/boost/type_traits/object_traits.hpp index 4919b01..41dd46f 100644 --- a/include/boost/type_traits/object_traits.hpp +++ b/include/boost/type_traits/object_traits.hpp @@ -380,6 +380,36 @@ template struct is_empty #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct is_base_and_derived +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::is_convertible::value, + ::boost::is_class::value, + ::boost::is_class::value + >::value) + ); +}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct is_base_and_derived +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_base_and_derived +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_base_and_derived +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif + } // namespace boost #endif // BOOST_OBJECT_TYPE_TRAITS_HPP