30#ifndef _RWSTD_RW_META_OTHER_H_INCLUDED
31#define _RWSTD_RW_META_OTHER_H_INCLUDED
45template <
bool _Select,
class _TypeT,
class _TypeU>
46struct __rw_conditional
51template <
class _TypeT,
class _TypeU>
52struct __rw_conditional<
false, _TypeT, _TypeU>
57#define _RWSTD_CONDITIONAL(C,T,U) _RW::__rw_conditional<C,T,U>::type
60#ifndef _RWSTD_NO_ALIGN_TRAITS
65template <_RWSTD_SIZE_T _Size, _RWSTD_SIZE_T _N,
66 bool = (_RWSTD_TT_MAX_ALIGNMENT <= _N * 2)
68struct __rw_default_alignment_impl
70 enum {
value = __rw_default_alignment_impl<_Size, _N * 2>::value };
77template <_RWSTD_SIZE_T _Size, _RWSTD_SIZE_T _N>
78struct __rw_default_alignment_impl<_Size, _N, true>
88template <_RWSTD_SIZE_T _Size>
89struct __rw_default_alignment
91 enum {
value = __rw_default_alignment_impl<_Size, 1>::value };
96template <_RWSTD_SIZE_T _Size,
97 _RWSTD_SIZE_T _Align = __rw_default_alignment<_Size>::value>
98struct __rw_aligned_storage
101 _RWSTD_TT_ALIGNED_POD (_Align) _C_align;
102 unsigned char _C_size [_Size];
109template <_RWSTD_SIZE_T _Align>
110struct __rw_aligned_storage_impl;
112#define _RWSTD_ALIGNED_STORAGE_SPEC(N) \
113 template <> struct __rw_aligned_storage_impl<N> { \
114 typedef _RWSTD_TT_ALIGNED_POD (N) _C_type; };
122#if (32 <= _RWSTD_TT_MAX_ALIGNMENT)
126#if (64 <= _RWSTD_TT_MAX_ALIGNMENT)
130#if (128 <= _RWSTD_TT_MAX_ALIGNMENT)
134#if (256 <= _RWSTD_TT_MAX_ALIGNMENT)
138#if (512 <= _RWSTD_TT_MAX_ALIGNMENT)
142#if (1024 <= _RWSTD_TT_MAX_ALIGNMENT)
146#if (2048 <= _RWSTD_TT_MAX_ALIGNMENT)
150#if (4096 <= _RWSTD_TT_MAX_ALIGNMENT)
154#if (8192 <= _RWSTD_TT_MAX_ALIGNMENT)
158template <_RWSTD_SIZE_T _Size,
159 _RWSTD_SIZE_T _Align = __rw_default_alignment<_Size>::value>
160struct __rw_aligned_storage
164 __rw_aligned_storage_impl<_Align>::_C_type _C_align;
166 unsigned char _C_size [_Size];
173#ifndef _RWSTD_NO_VARIADIC_TEMPLATES
177template <
class... _Types>
180template <
class _TypeT,
class... _Types>
181struct __rw_biggest<_TypeT, _Types...>
183 enum { _C_values = __rw_biggest<_Types...>::_C_value,
184 _C_value =
sizeof (_TypeT) < _C_values
189template <
class _TypeT>
190struct __rw_biggest<_TypeT>
192 enum { _C_value =
sizeof (_TypeT) };
196template <
class... _Types>
197struct __rw_strictest;
199template <
class _TypeT,
class... _Types>
200struct __rw_strictest<_TypeT, _Types...>
202 enum { _C_values = __rw_strictest<_Types...>::_C_value,
203 _C_value = __rw_alignment_of<_TypeT>::value < _C_values
205 : __rw_alignment_of<_TypeT>::value };
208template <
class _TypeT>
209struct __rw_strictest<_TypeT>
211 enum { _C_value = __rw_alignment_of<_TypeT>::value };
214template <_RWSTD_SIZE_T _Len,
class... _Types>
215struct __rw_aligned_union;
217template <_RWSTD_SIZE_T _Len,
class _TypeT,
class... _Types>
218struct __rw_aligned_union<_Len, _TypeT, _Types...>
220 enum { _C_len_value = _Len,
221 _C_size_value = __rw_biggest<_TypeT, _Types...>::_C_value,
222 _C_align_value = __rw_strictest<_TypeT, _Types...>::_C_value };
225 __rw_aligned_storage< _C_len_value < _C_size_value
226 ? _C_size_value : _C_len_value,
227 _C_align_value>::type type;
233template <
unsigned _A ,
unsigned _B = 0,
234 unsigned _C = 0,
unsigned _D = 0,
235 unsigned _E = 0,
unsigned _F = 0,
236 unsigned _G = 0,
unsigned _H = 0>
240 _C_ab = _A < _B ? _B : _A,
241 _C_cd = _C < _D ? _D : _C,
242 _C_abcd = _C_ab < _C_cd ? _C_cd : _C_ab,
244 _C_ef = _E < _F ? _F : _E,
245 _C_gh = _G < _H ? _H : _G,
246 _C_efgh = _C_ef < _C_gh ? _C_gh : _C_ef,
248 _C_value = _C_abcd < _C_efgh ? _C_efgh : _C_abcd
252struct __rw_empty { };
255template <
class _Type1 ,
class _Type2 = __rw_empty,
256 class _Type3 = __rw_empty,
class _Type4 = __rw_empty,
257 class _Type5 = __rw_empty,
class _Type6 = __rw_empty,
258 class _Type7 = __rw_empty,
class _Type8 = __rw_empty>
262 __rw_max_uint<
sizeof (_Type1),
sizeof (_Type2),
263 sizeof (_Type3),
sizeof (_Type4),
264 sizeof (_Type5),
sizeof (_Type6),
265 sizeof (_Type7),
sizeof (_Type8)>::_C_value
270template <
class _Type1 ,
class _Type2 = __rw_empty,
271 class _Type3 = __rw_empty,
class _Type4 = __rw_empty,
272 class _Type5 = __rw_empty,
class _Type6 = __rw_empty,
273 class _Type7 = __rw_empty,
class _Type8 = __rw_empty>
277 __rw_max_uint<__rw_alignment_of<_Type1>::value,
278 __rw_alignment_of<_Type2>::value,
279 __rw_alignment_of<_Type3>::value,
280 __rw_alignment_of<_Type4>::value,
281 __rw_alignment_of<_Type5>::value,
282 __rw_alignment_of<_Type6>::value,
283 __rw_alignment_of<_Type7>::value,
284 __rw_alignment_of<_Type8>::value>::_C_value
288template <_RWSTD_SIZE_T _Len,
289 class _Type1 ,
class _Type2 = __rw_empty,
290 class _Type3 = __rw_empty,
class _Type4 = __rw_empty,
291 class _Type5 = __rw_empty,
class _Type6 = __rw_empty,
292 class _Type7 = __rw_empty,
class _Type8 = __rw_empty>
293struct __rw_aligned_union
295 enum { _C_len_value = _Len,
297 __rw_biggest<_Type1, _Type2, _Type3, _Type4,
298 _Type5, _Type6, _Type7, _Type8>::_C_value,
300 __rw_strictest<_Type1, _Type2, _Type3, _Type4,
301 _Type5, _Type6, _Type7, _Type8>::_C_value
305 __rw_aligned_storage< _C_size_value < _C_len_value
306 ? _C_len_value : _C_size_value,
307 _C_align_value>::type type;
315template <
bool _Enable,
class _TypeT =
void>
321template <
class _TypeT>
322struct __rw_enable_if<
false, _TypeT>
326#define _RWSTD_ENABLE_IF(C,T) _RW::__rw_enable_if<C,T>::type
329template <
bool _Enable,
class _TypeT =
void>
330struct __rw_disable_if
335template <
class _TypeT>
336struct __rw_disable_if<
true, _TypeT>
340#define _RWSTD_DISABLE_IF(C,T) _RW::__rw_disable_if<C,T>::type
343template <
class _TypeT>
348 __rw_remove_reference<_TypeT>::type _TypeU;
351 __rw_conditional<__rw_is_function<_TypeU>::value,
352 typename __rw_add_pointer<_TypeU>::type,
353 typename __rw_remove_cv<_TypeU>::type
358 __rw_conditional<__rw_is_array<_TypeU>::value,
359 typename __rw_remove_extent<_TypeU>::type*,
364#define _RWSTD_DECAY(T) _RW::__rw_decay<T>::type
#define _RWSTD_NAMESPACE(name)