00001 #ifndef __IS_BASE_OF_HH__
00002 #define __IS_BASE_OF_HH__
00003
00004 #include "fastjet/internal/numconsts.hh"
00005
00006 FASTJET_BEGIN_NAMESPACE
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00032 template<typename T, T _t>
00033 struct integral_type{
00034 static const T value = _t;
00035 typedef T value_type;
00036 typedef integral_type<T,_t> type;
00037 };
00038
00039
00040 template<typename T, T _t>
00041 const T integral_type<T, _t>::value;
00042
00043
00044 typedef integral_type<bool, true> true_type;
00045 typedef integral_type<bool, false> false_type;
00046
00047
00048
00049
00050
00051 typedef char (&__yes_type)[1];
00052 typedef char (&__no_type) [2];
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00076 template<typename B, typename D>
00077 struct __inheritance_helper{
00078 #if !((_MSC_VER !=0 ) && (_MSC_VER == 1310)) // MSVC 7.1
00079 template <typename T>
00080 static __yes_type check_sig(D const volatile *, T);
00081 #else
00082 static __yes_type check_sig(D const volatile *, long);
00083 #endif
00084 static __no_type check_sig(B const volatile *, int);
00085 };
00086
00098 template<typename B, typename D>
00099 struct IsBaseAndDerived{
00100 #if ((_MSC_FULL_VER != 0) && (_MSC_FULL_VER >= 140050000))
00101 #pragma warning(push)
00102 #pragma warning(disable:6334)
00103 #endif
00104
00105
00113 struct Host{
00114 #if !((_MSC_VER !=0 ) && (_MSC_VER == 1310))
00115 operator B const volatile *() const;
00116 #else
00117 operator B const volatile * const&() const;
00118 #endif
00119 operator D const volatile *();
00120 };
00121
00123 static const bool value = ((sizeof(B)!=0) && (sizeof(D)!=0) && (sizeof(__inheritance_helper<B,D>::check_sig(Host(), 0)) == sizeof(__yes_type)));
00124
00125 #if ((_MSC_FULL_VER != 0) && (_MSC_FULL_VER >= 140050000))
00126 #pragma warning(pop)
00127 #endif
00128 };
00129
00130 FASTJET_END_NAMESPACE
00131
00132
00133 #endif // __IS_BASE_OF_HH__