]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/type_traits/is_virtual_base_of.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / type_traits / is_virtual_base_of.hpp
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).
5 //
6 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
7
8 #ifndef BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED
9 #define BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED
10
11 #include <boost/type_traits/is_base_of.hpp>
12 #include <boost/type_traits/is_same.hpp>
13
14 namespace boost {
15 namespace detail {
16
17
18 #ifdef BOOST_MSVC
19 #pragma warning( push )
20 #pragma warning( disable : 4584 4250 4594)
21 #elif defined(__GNUC__) && (__GNUC__ >= 4)
22 #pragma GCC system_header
23 #endif
24
25 template<typename Base, typename Derived, typename tag>
26 struct is_virtual_base_of_impl
27 {
28 BOOST_STATIC_CONSTANT(bool, value = false);
29 };
30
31 template<typename Base, typename Derived>
32 struct is_virtual_base_of_impl<Base, Derived, true_type>
33 {
34 union max_align
35 {
36 unsigned u;
37 unsigned long ul;
38 void* v;
39 double d;
40 long double ld;
41 #ifndef BOOST_NO_LONG_LONG
42 long long ll;
43 #endif
44 };
45 #ifdef __BORLANDC__
46 struct boost_type_traits_internal_struct_X : public virtual Derived, public virtual Base
47 {
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();
52 max_align data[4];
53 };
54 struct boost_type_traits_internal_struct_Y : public virtual Derived
55 {
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();
60 max_align data[4];
61 };
62 #else
63 struct boost_type_traits_internal_struct_X : public Derived, virtual Base
64 {
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();
69 max_align data[16];
70 };
71 struct boost_type_traits_internal_struct_Y : public Derived
72 {
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();
77 max_align data[16];
78 };
79 #endif
80 BOOST_STATIC_CONSTANT(bool, value = (sizeof(boost_type_traits_internal_struct_X)==sizeof(boost_type_traits_internal_struct_Y)));
81 };
82
83 template<typename Base, typename Derived>
84 struct is_virtual_base_of_impl2
85 {
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);
89 };
90
91 #ifdef BOOST_MSVC
92 #pragma warning( pop )
93 #endif
94
95 } // namespace detail
96
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)>{};
98
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{};
102
103 } // namespace boost
104
105 #endif