is_base_of_tr1.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // (C) Copyright Rani Sharoni 2003-2005.
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. //
  6. // See http://www.boost.org/libs/type_traits for most recent version including documentation.
  7. #ifndef BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED
  8. #define BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED
  9. #include <boost/type_traits/is_base_and_derived.hpp>
  10. #include <boost/type_traits/is_same.hpp>
  11. #include <boost/type_traits/is_class.hpp>
  12. namespace boost { namespace tr1{
  13. namespace detail{
  14. template <class B, class D>
  15. struct is_base_of_imp
  16. {
  17. typedef typename remove_cv<B>::type ncvB;
  18. typedef typename remove_cv<D>::type ncvD;
  19. BOOST_STATIC_CONSTANT(bool, value = ((::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value) || (::boost::is_same<ncvB,ncvD>::value)));
  20. };
  21. }
  22. template <class Base, class Derived> struct is_base_of
  23. : public integral_constant<bool, (::boost::tr1::detail::is_base_of_imp<Base, Derived>::value)>{};
  24. template <class Base, class Derived> struct is_base_of<Base, Derived&> : public false_type{};
  25. template <class Base, class Derived> struct is_base_of<Base&, Derived&> : public false_type{};
  26. template <class Base, class Derived> struct is_base_of<Base&, Derived> : public false_type{};
  27. } } // namespace boost
  28. #endif // BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED