1 // (C) Copyright Daniel Frey and Robert Ramey 2009.
\r
2 // Use, modification and distribution are subject to the Boost Software License,
\r
3 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
\r
4 // http://www.boost.org/LICENSE_1_0.txt).
\r
6 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
\r
8 #ifndef BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED
\r
9 #define BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED
\r
11 #include <boost/type_traits/is_base_of.hpp>
\r
12 #include <boost/type_traits/is_same.hpp>
\r
13 #include <boost/mpl/and.hpp>
\r
14 #include <boost/mpl/not.hpp>
\r
16 // should be the last #include
\r
17 #include <boost/type_traits/detail/bool_trait_def.hpp>
\r
24 #pragma warning( push )
\r
25 #pragma warning( disable : 4584 )
\r
26 #elif defined __GNUC__
\r
27 #pragma GCC system_header
\r
30 template<typename Base, typename Derived, typename tag>
\r
31 struct is_virtual_base_of_impl
\r
33 BOOST_STATIC_CONSTANT(bool, value = false);
\r
36 template<typename Base, typename Derived>
\r
37 struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
\r
40 struct X : public virtual Derived, public virtual Base
\r
44 X& operator=(const X&);
\r
47 struct Y : public virtual Derived
\r
51 Y& operator=(const Y&);
\r
55 struct X : Derived, virtual Base
\r
59 X& operator=(const X&);
\r
66 Y& operator=(const Y&);
\r
70 BOOST_STATIC_CONSTANT(bool, value = (sizeof(X)==sizeof(Y)));
\r
73 template<typename Base, typename Derived>
\r
74 struct is_virtual_base_of_impl2
\r
76 typedef typename mpl::and_<is_base_of<Base, Derived>, mpl::not_<is_same<Base, Derived> > >::type tag_type;
\r
77 typedef is_virtual_base_of_impl<Base, Derived, tag_type> imp;
\r
78 BOOST_STATIC_CONSTANT(bool, value = imp::value);
\r
82 #pragma warning( pop )
\r
85 } // namespace detail
\r
87 BOOST_TT_AUX_BOOL_TRAIT_DEF2(
\r
91 , (::boost::detail::is_virtual_base_of_impl2<Base,Derived>::value)
\r
94 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
\r
95 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived,false)
\r
96 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base,Derived&,false)
\r
97 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived&,false)
\r
100 } // namespace boost
\r
102 #include <boost/type_traits/detail/bool_trait_undef.hpp>
\r