Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
_select.h
Go to the documentation of this file.
1
32#ifndef _RWSTD_RW_SELECT_H_INCLUDED
33#define _RWSTD_RW_SELECT_H_INCLUDED
34
35#ifndef _RWSTD_RW_DEFS_H_INCLUDED
36# include <rw/_defs.h>
37#endif // _RWSTD_RW_DEFS_H_INCLUDED
38
39
41
42struct __rw_false_t { enum { _C_val }; };
43struct __rw_true_t { enum { _C_val = 1 }; };
44
45
46template <class _TypeT>
47struct __rw_select_int
48{
49 typedef void* _SelectT;
50
51#if defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x530
52
53 void* _C_selector;
54
55#endif // SunPro
56};
57
58
59#define _RWSTD_SPECIALIZE_IS_INT(T) \
60 _RWSTD_SPECIALIZED_CLASS \
61 struct __rw_select_int<T> { \
62 typedef int _SelectT; \
63 enum { _C_selector = 1 }; \
64 }
65
66#ifndef _RWSTD_NO_NATIVE_BOOL
68#endif // _RWSTD_NO_NATIVE_BOOL
69
71_RWSTD_SPECIALIZE_IS_INT (signed char);
72_RWSTD_SPECIALIZE_IS_INT (unsigned char);
74_RWSTD_SPECIALIZE_IS_INT (unsigned short);
76_RWSTD_SPECIALIZE_IS_INT (unsigned int);
78_RWSTD_SPECIALIZE_IS_INT (unsigned long);
79
80#ifdef _RWSTD_LONG_LONG
83#endif // _RWSTD_LONG_LONG
84
85#ifndef _RWSTD_NO_NATIVE_WCHAR_T
87#endif // _RWSTD_NO_NATIVE_WCHAR_T
88
89
90#if !defined (__SUNPRO_CC) || __SUNPRO_CC > 0x530
91# define _RWSTD_DISPATCH(iter) \
92 (typename _RW::__rw_select_int< iter >::_SelectT (1L))
93
94#else
95 // working around a SunPro 5.3 a prior bug (PR #28739)
96# define _RWSTD_DISPATCH(iter) _RW::__rw_select_int< iter >()._C_selector
97#endif
98
99
100#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
101
102template <class _TypeT, class _TypeU>
103struct __rw_same_type
104{
105 typedef __rw_false_t _C_type;
106 enum { _C_val };
107};
108
109template <class _TypeT>
110struct __rw_same_type<_TypeT, _TypeT>
111{
112 typedef __rw_true_t _C_type;
113 enum { _C_val = 1 };
114};
115
116#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
117
118template <bool flag>
119struct __rw_bool_t
120{
121 typedef __rw_false_t _C_type;
122};
123
125struct __rw_bool_t<true>
126{
127 typedef __rw_true_t _C_type;
128};
129
130template <class _TypeT, class _TypeU>
131struct __rw_same_type
132{
133 struct _C_yes {};
134 struct _C_no { _C_yes no_ [2]; };
135 template <class _TypeV>
136 struct _C_Type {};
137
138 static _C_yes test (_C_Type<_TypeT>, _C_Type<_TypeT>);
139 static _C_no test (...);
140
141 enum { _C_val = sizeof (test (_C_Type<_TypeT> (),
142 _C_Type<_TypeU> ())) == sizeof (_C_yes) };
143
144 typedef typename __rw_bool_t<_C_val>::_C_type _C_type;
145};
146
147#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
148
149
150} // namespace __rw
151
152
153# if defined (__IBMCPP__) && __IBMCPP__ <= 500
154
155// working around an xlC 5.0 bug
156_USING (__rw::__rw_select_int);
157
158# endif // VisualAge 5.0
159
160
161#endif // _RWSTD_RW_SELECT_H_INCLUDED
#define _RWSTD_SPECIALIZED_CLASS
#define _RWSTD_LONG_LONG
#define _RWSTD_NAMESPACE(name)
Definition _defs.h:567
#define _USING(name)
Definition _defs.h:568
#define _RWSTD_SPECIALIZE_IS_INT(T)
#define true
Definition stdbool.h:25