1 // (C) Copyright Daniel Frey and Robert Ramey 2009.
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).
6 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
8 #ifndef BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED
9 #define BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED
11 #include <boost/type_traits/is_base_of.hpp>
12 #include <boost/type_traits/is_same.hpp>
19 #pragma warning( push )
20 #pragma warning( disable : 4584 4250 4594)
21 #elif defined(__GNUC__) && (__GNUC__ >= 4)
22 #pragma GCC system_header
25 template<typename Base, typename Derived, typename tag>
26 struct is_virtual_base_of_impl
28 BOOST_STATIC_CONSTANT(bool, value = false);
31 template<typename Base, typename Derived>
32 struct is_virtual_base_of_impl<Base, Derived, true_type>
41 #ifndef BOOST_NO_LONG_LONG
46 struct boost_type_traits_internal_struct_X : public virtual Derived, public virtual Base
48 boost_type_traits_internal_struct_X();
49 boost_type_traits_internal_struct_X(const boost_type_traits_internal_struct_X&);
50 boost_type_traits_internal_struct_X& operator=(const boost_type_traits_internal_struct_X&);
51 ~boost_type_traits_internal_struct_X()throw();
54 struct boost_type_traits_internal_struct_Y : public virtual Derived
56 boost_type_traits_internal_struct_Y();
57 boost_type_traits_internal_struct_Y(const boost_type_traits_internal_struct_Y&);
58 boost_type_traits_internal_struct_Y& operator=(const boost_type_traits_internal_struct_Y&);
59 ~boost_type_traits_internal_struct_Y()throw();
63 struct boost_type_traits_internal_struct_X : public Derived, virtual Base
65 boost_type_traits_internal_struct_X();
66 boost_type_traits_internal_struct_X(const boost_type_traits_internal_struct_X&);
67 boost_type_traits_internal_struct_X& operator=(const boost_type_traits_internal_struct_X&);
68 ~boost_type_traits_internal_struct_X()throw();
71 struct boost_type_traits_internal_struct_Y : public Derived
73 boost_type_traits_internal_struct_Y();
74 boost_type_traits_internal_struct_Y(const boost_type_traits_internal_struct_Y&);
75 boost_type_traits_internal_struct_Y& operator=(const boost_type_traits_internal_struct_Y&);
76 ~boost_type_traits_internal_struct_Y()throw();
80 BOOST_STATIC_CONSTANT(bool, value = (sizeof(boost_type_traits_internal_struct_X)==sizeof(boost_type_traits_internal_struct_Y)));
83 template<typename Base, typename Derived>
84 struct is_virtual_base_of_impl2
86 typedef boost::integral_constant<bool, (boost::is_base_of<Base, Derived>::value && ! boost::is_same<Base, Derived>::value)> tag_type;
87 typedef is_virtual_base_of_impl<Base, Derived, tag_type> imp;
88 BOOST_STATIC_CONSTANT(bool, value = imp::value);
92 #pragma warning( pop )
97 template <class Base, class Derived> struct is_virtual_base_of : public integral_constant<bool, (::boost::detail::is_virtual_base_of_impl2<Base, Derived>::value)>{};
99 template <class Base, class Derived> struct is_virtual_base_of<Base&, Derived> : public false_type{};
100 template <class Base, class Derived> struct is_virtual_base_of<Base, Derived&> : public false_type{};
101 template <class Base, class Derived> struct is_virtual_base_of<Base&, Derived&> : public false_type{};