30#ifndef _RWSTD_RW_META_REL_H_INCLUDED
31#define _RWSTD_RW_META_REL_H_INCLUDED
35#ifndef _RWSTD_TT_IS_CONVERTIBLE
43#ifndef _RWSTD_TT_IS_BASE_OF
50template <
class _TypeT,
class _TypeU>
51struct __rw_is_same : __rw_false_type
55template <
class _TypeT>
56struct __rw_is_same<_TypeT, _TypeT> : __rw_true_type
60#define _RWSTD_IS_SAME(T,U) _RW::__rw_is_same<T,U>::value
63#ifndef _RWSTD_TT_IS_BASE_OF
69template <
class _Base,
class _Derived,
70 bool = __rw_is_class<_Base>::value
71 && __rw_is_class<_Derived>::value>
72struct __rw_is_base_of_impl
74 enum { _C_value = 0 };
84template <
class _Base,
class _Derived>
85struct __rw_is_base_of_impl<_Base, _Derived,
true>
88 struct _C_yes { _C_no __pad [2]; };
92 operator const volatile _Base& ()
const;
93 operator const volatile _Derived& ();
98 template <
class _TypeT>
99 static _C_yes _C_is (
const volatile _Derived&, _TypeT);
100 static _C_no _C_is (
const volatile _Base& ,
int);
104 _RW::__rw_is_same<
const volatile _Base,
105 const volatile _Derived&>
::value
106 ||
sizeof (_C_yes) ==
sizeof (_C_nest::_C_is (_C_nest (), 0))
114template <
class _TypeT>
115struct __rw_is_base_of_impl<_TypeT, _TypeT,
true>
117 enum { _C_value = 1 };
120# define _RWSTD_IS_BASE_OF(T,U) \
121 _RW::__rw_is_base_of_impl<T,U>::_C_value
123#elif defined (_MSC_VER)
124# define _RWSTD_IS_BASE_OF(T,U) \
125 ( _RW::__rw_is_class<T>::value \
126 && _RW::__rw_is_class<U>::value \
127 && _RWSTD_TT_IS_BASE_OF(T,U))
129# define _RWSTD_IS_BASE_OF(T,U) _RWSTD_TT_IS_BASE_OF(T,U)
132template <
class _Base,
class _Derived>
133struct __rw_is_base_of
134 : __rw_integral_constant<bool, _RWSTD_IS_BASE_OF(_Base,_Derived)>
143#if !defined (_RWSTD_TT_IS_CONVERTIBLE)
145template <
class _From,
class _To>
146struct __rw_is_convertible_impl
149 struct _C_yes { _C_no __pad [2]; };
153 template <
class _Anything>
157 template <
class _TypeT>
158 static _C_no _C_is (_Dummy, _TypeT);
159 static _C_yes _C_is (_To,
int);
161 static _From _C_make ();
163 enum { _C_value =
sizeof (_C_yes) ==
sizeof (_C_is (_C_make (), 0)) };
166template <
class _TypeT,
class _TypeU,
167 bool = __rw_is_array<_TypeT>::value,
168 bool = __rw_is_function<_TypeT>::value>
169struct __rw_is_convertible_3
173 enum { _C_value = __rw_is_convertible_impl<_TypeT, _TypeU>::_C_value };
176template <
class _TypeT,
class _TypeU>
177struct __rw_is_convertible_3<_TypeT, _TypeU,
true,
false>
180 typedef typename __rw_remove_extent<_TypeT>::type _TypeV;
181 typedef typename __rw_add_pointer<_TypeV>::type _TypeT_Ptr;
184 __rw_is_convertible_impl<_TypeT_Ptr, _TypeU>::_C_value };
187template <
class _TypeT,
class _TypeU>
188struct __rw_is_convertible_3<_TypeT, _TypeU,
false,
true>
191 typedef typename __rw_add_lvalue_reference<_TypeT>::type _TypeT_Ref;
192 typedef typename __rw_add_pointer<_TypeT>::type _TypeT_Ptr;
195 __rw_is_convertible_impl<_TypeT_Ref, _TypeU>::_C_value
196 || __rw_is_convertible_impl<_TypeT_Ptr, _TypeU>::_C_value };
199template <
class _TypeT,
class _TypeU,
200 bool = __rw_is_array<_TypeU>::value
201 || __rw_is_function<_TypeU>::value>
202struct __rw_is_convertible_2
205 enum { _C_value = __rw_is_convertible_3<_TypeT, _TypeU>::_C_value };
208template <
class _TypeT,
class _TypeU>
209struct __rw_is_convertible_2<_TypeT, _TypeU,
true>
213 enum { _C_value = 0 };
216template <class _TypeT, class _TypeU, bool = __rw_is_void<_TypeT>::value,
217 bool = __rw_is_void<_TypeU>::value>
218struct __rw_is_convertible_1
221 enum { _C_value = 0 };
224template <
class _TypeT,
class _TypeU>
225struct __rw_is_convertible_1<_TypeT, _TypeU,
false,
false>
228 enum { _C_value = __rw_is_convertible_2<_TypeT,_TypeU>::_C_value };
231template <
class _TypeT,
class _TypeU>
232struct __rw_is_convertible_1<_TypeT, _TypeU,
true,
true>
235 enum { _C_value = 1 };
238# define _RWSTD_IS_CONVERTIBLE(T,U) \
239 _RW::__rw_is_convertible_1<T,U>::_C_value
241#elif defined (_MSC_VER)
243template <
class _TypeT,
class _TypeU>
244struct __rw_is_convertible_1
247 __rw_is_void<_TypeT>::value && __rw_is_void<_TypeU>::value
248 || _RWSTD_TT_IS_CONVERTIBLE(_TypeT, _TypeU) };
251# define _RWSTD_IS_CONVERTIBLE(T,U) \
252 _RW::__rw_is_convertible_1<T,U>::_C_value
255# define _RWSTD_IS_CONVERTIBLE(T,U) _RWSTD_TT_IS_CONVERTIBLE(T,U)
258template <
class _TypeT,
class _TypeU>
259struct __rw_is_convertible
260 : __rw_integral_constant<bool, _RWSTD_IS_CONVERTIBLE(_TypeT,_TypeU)>
#define _RWSTD_NAMESPACE(name)