source: vendor/nemo/current/NEMOGCM/EXTERNAL/XIOS/extern/boost/include/boost/type_traits/is_virtual_base_of.hpp @ 44

Last change on this file since 44 was 44, checked in by cholod, 12 years ago

Load NEMO_TMP into vendor/nemo/current.

File size: 2.7 KB
Line 
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#include <boost/mpl/and.hpp>
14#include <boost/mpl/not.hpp>
15
16// should be the last #include
17#include <boost/type_traits/detail/bool_trait_def.hpp>
18
19namespace boost {
20namespace detail {
21
22
23#ifdef BOOST_MSVC
24#pragma warning( push )
25#pragma warning( disable : 4584 )
26#elif defined __GNUC__
27#pragma GCC system_header
28#endif
29
30template<typename Base, typename Derived, typename tag>
31struct is_virtual_base_of_impl
32{
33    BOOST_STATIC_CONSTANT(bool, value = false);
34};
35
36template<typename Base, typename Derived>
37struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
38{
39#ifdef __BORLANDC__
40    struct X : public virtual Derived, public virtual Base
41    {
42       X();
43       X(const X&);
44       X& operator=(const X&);
45       ~X()throw();
46    };
47    struct Y : public virtual Derived
48    {
49       Y();
50       Y(const Y&);
51       Y& operator=(const Y&);
52       ~Y()throw();
53    };
54#else
55    struct X : Derived, virtual Base
56    {
57       X();
58       X(const X&);
59       X& operator=(const X&);
60       ~X()throw();
61    };
62    struct Y : Derived
63    {
64       Y();
65       Y(const Y&);
66       Y& operator=(const Y&);
67       ~Y()throw();
68    };
69#endif
70    BOOST_STATIC_CONSTANT(bool, value = (sizeof(X)==sizeof(Y)));
71};
72
73template<typename Base, typename Derived>
74struct is_virtual_base_of_impl2
75{
76   typedef typename mpl::and_<is_base_of<Base, Derived>, mpl::not_<is_same<Base, Derived> > >::type tag_type;
77   typedef is_virtual_base_of_impl<Base, Derived, tag_type> imp;
78   BOOST_STATIC_CONSTANT(bool, value = imp::value);
79};
80
81#ifdef BOOST_MSVC
82#pragma warning( pop )
83#endif
84
85} // namespace detail
86
87BOOST_TT_AUX_BOOL_TRAIT_DEF2(
88      is_virtual_base_of
89       , Base
90       , Derived
91       , (::boost::detail::is_virtual_base_of_impl2<Base,Derived>::value) 
92)
93
94#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
95BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived,false)
96BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base,Derived&,false)
97BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived&,false)
98#endif
99
100} // namespace boost
101
102#include <boost/type_traits/detail/bool_trait_undef.hpp>
103
104#endif
Note: See TracBrowser for help on using the repository browser.