1 // xxresult internal header
2 // NOTE: no include guard
3
4 #define _RESULT_TYPE _CLASS_NAME(_Result_type)
5 #define _RESULT_OF _CLASS_NAME(_Result_of)
6
7 // TEMPLATE CLASS _Result_typeX
8 template<bool,
9     class _Fty
10     _C_CLASS_ARG0>
11     struct _RESULT_TYPE;
12
13 template<class _Fty
14     _C_CLASS_ARG0>
15     struct _RESULT_TYPE<true, _Fty _C_ARG0_ARG1>
16     {    // define return type for UDT with nested type named result_type
17     typedef typename _Fty::result_type _Type;
18     };
19
20 template<class _Fty
21     _C_CLASS_ARG0>
22     struct _RESULT_TYPE<false, _Fty _C_ARG0_ARG1>
23     {    // define return type for UDT without nested type named result_type
24
25  #if _NARGS == 0
26     typedef void _Type;
27
28  #else /* _NARGS */
29     typedef typename _Fty::template result<_Fty(_ARG0_ARG1)>::type _Type;
30  #endif /* _NARGS */
31
32     };
33
34     // TEMPLATE CLASS _Result_of
35 template<class _Fty
36     _C_CLASS_FARG0>
37     struct _RESULT_OF
38     {    // UDT
39     static const bool _Value = _HAS_RESULT_TYPE(_Fty);
40     typedef typename _RESULT_TYPE<
41         _RESULT_OF<_Fty _C_FARG0_FARG1>::_Value,
Lines 42 ... 51 are skipped.
52
53 template<class _Ret
54     _C_CLASS_ARG0
55     _C_CLASS_FARG0>
56     struct _RESULT_OF<_Ret(*)(_ARG0_ARG1) _C_FARG0_FARG1>
57     {    // pointer to function
58     typedef _Ret _Type;
59     };
60
61 template<class _Ret
62     _C_CLASS_ARG0
63     _C_CLASS_FARG0>
64     struct _RESULT_OF<_Ret(* const)(_ARG0_ARG1) _C_FARG0_FARG1>
65     {    // const pointer to function
66     typedef _Ret _Type;
67     };
68
69  #if _NARGS == 1
70 template<class _Rx,
71     class _Arg0,
72     class _Farg0>
73     struct _RESULT_OF<_Rx _Arg0::*, _Farg0&>
74     {    // pointer to member data
75     typedef typename _Copy_cv<_Rx, _Farg0&>::_Type _Type;
76     };
77
78 template<class _Rx,
79     class _Arg0,
80     class _Farg0>
81     struct _RESULT_OF<_Rx _Arg0::*const, _Farg0&>
82     {    // pointer to member data
83     typedef typename _Copy_cv<_Rx, _Farg0&>::_Type _Type;
84     };
85  #endif /* _NARGS == 1 */
86
87  #if _NARGS != 0
88     // TEMPLATE FUNCTION _RESULT_OF, pointer to member fn
89 template<class _Rx,
90     _CLASS_ARG0
91     _C_CLASS_FARG0>
92     struct _RESULT_OF<_Rx (__thiscall _Arg0::*)(_ARG1_ARG2),
93         _Farg0& _C_FARG1_FARG2>
94     {    // pointer to member fn
95     typedef _Rx _Type;
96     };
97
98  #ifdef _M_IX86
99 template<class _Rx,
100     _CLASS_ARG0
101     _C_CLASS_FARG0>
102     struct _RESULT_OF<_Rx (__cdecl _Arg0::*)(_ARG1_ARG2),
103         _Farg0& _C_FARG1_FARG2>
104     {    // pointer to member fn
105     typedef _Rx _Type;
106     };
107
108 template<class _Rx,
109     _CLASS_ARG0
110     _C_CLASS_FARG0>
111     struct _RESULT_OF<_Rx (__stdcall _Arg0::*)(_ARG1_ARG2),
112         _Farg0& _C_FARG1_FARG2>
113     {    // pointer to member fn
114     typedef _Rx _Type;
115     };
116
117   #ifndef _M_CEE
118 template<class _Rx,
119     _CLASS_ARG0
120     _C_CLASS_FARG0>
121     struct _RESULT_OF<_Rx (__fastcall _Arg0::*)(_ARG1_ARG2),
122         _Farg0& _C_FARG1_FARG2>
123     {    // pointer to member fn
124     typedef _Rx _Type;
125     };
126   #endif /* _M_CEE */
127  #endif /* _M_IX86 */
128
129  #ifdef _M_CEE
130 template<class _Rx,
131     _CLASS_ARG0
132     _C_CLASS_FARG0>
133     struct _RESULT_OF<_Rx (__clrcall _Arg0::*)(_ARG1_ARG2),
134         _Farg0& _C_FARG1_FARG2>
135     {    // pointer to member fn
136     typedef _Rx _Type;
137     };
138  #endif /* _M_CEE */
139
140     // TEMPLATE FUNCTION _RESULT_OF, pointer to const member fn
141 template<class _Rx,
142     _CLASS_ARG0
143     _C_CLASS_FARG0>
144     struct _RESULT_OF<_Rx (__thiscall _Arg0::*)(_ARG1_ARG2) const,
145         _Farg0& _C_FARG1_FARG2>
146     {    // pointer to const member fn
147     typedef _Rx _Type;
148     };
149
150  #ifdef _M_IX86
151 template<class _Rx,
152     _CLASS_ARG0
153     _C_CLASS_FARG0>
154     struct _RESULT_OF<_Rx (__cdecl _Arg0::*)(_ARG1_ARG2) const,
155         _Farg0& _C_FARG1_FARG2>
156     {    // pointer to const member fn
157     typedef _Rx _Type;
158     };
159
160 template<class _Rx,
161     _CLASS_ARG0
162     _C_CLASS_FARG0>
163     struct _RESULT_OF<_Rx (__stdcall _Arg0::*)(_ARG1_ARG2) const,
164         _Farg0& _C_FARG1_FARG2>
165     {    // pointer to const member fn
166     typedef _Rx _Type;
167     };
168
169   #ifndef _M_CEE
170 template<class _Rx,
171     _CLASS_ARG0
172     _C_CLASS_FARG0>
173     struct _RESULT_OF<_Rx (__fastcall _Arg0::*)(_ARG1_ARG2) const,
174         _Farg0& _C_FARG1_FARG2>
175     {    // pointer to const member fn
176     typedef _Rx _Type;
177     };
178   #endif /* _M_CEE */
179  #endif /* _M_IX86 */
180
181  #ifdef _M_CEE
182 template<class _Rx,
183     _CLASS_ARG0
184     _C_CLASS_FARG0>
185     struct _RESULT_OF<_Rx (__clrcall _Arg0::*)(_ARG1_ARG2) const,
186         _Farg0& _C_FARG1_FARG2>
187     {    // pointer to const member fn
188     typedef _Rx _Type;
189     };
190  #endif /* _M_CEE */
191
192     // TEMPLATE FUNCTION _RESULT_OF, pointer to volatile member fn
193 template<class _Rx,
194     _CLASS_ARG0
195     _C_CLASS_FARG0>
196     struct _RESULT_OF<_Rx (__thiscall _Arg0::*)(_ARG1_ARG2) volatile,
197         _Farg0& _C_FARG1_FARG2>
198     {    // pointer to volatile member fn
199     typedef _Rx _Type;
200     };
201
202  #ifdef _M_IX86
203 template<class _Rx,
204     _CLASS_ARG0
205     _C_CLASS_FARG0>
206     struct _RESULT_OF<_Rx (__cdecl _Arg0::*)(_ARG1_ARG2) volatile,
207         _Farg0& _C_FARG1_FARG2>
208     {    // pointer to volatile member fn
209     typedef _Rx _Type;
210     };
211
212 template<class _Rx,
213     _CLASS_ARG0
214     _C_CLASS_FARG0>
215     struct _RESULT_OF<_Rx (__stdcall _Arg0::*)(_ARG1_ARG2) volatile,
216         _Farg0& _C_FARG1_FARG2>
217     {    // pointer to volatile member fn
218     typedef _Rx _Type;
219     };
220
221   #ifndef _M_CEE
222 template<class _Rx,
223     _CLASS_ARG0
224     _C_CLASS_FARG0>
225     struct _RESULT_OF<_Rx (__fastcall _Arg0::*)(_ARG1_ARG2) volatile,
226         _Farg0& _C_FARG1_FARG2>
227     {    // pointer to volatile member fn
228     typedef _Rx _Type;
229     };
230   #endif /* _M_CEE */
231  #endif /* _M_IX86 */
232
233  #ifdef _M_CEE
234 template<class _Rx,
235     _CLASS_ARG0
236     _C_CLASS_FARG0>
237     struct _RESULT_OF<_Rx (__clrcall _Arg0::*)(_ARG1_ARG2) volatile,
238         _Farg0& _C_FARG1_FARG2>
239     {    // pointer to volatile member fn
240     typedef _Rx _Type;
241     };
242  #endif /* _M_CEE */
243
244     // TEMPLATE FUNCTION _RESULT_OF, pointer to const volatile member fn
245 template<class _Rx,
246     _CLASS_ARG0
247     _C_CLASS_FARG0>
248     struct _RESULT_OF<_Rx (__thiscall _Arg0::*)(_ARG1_ARG2) const volatile,
249         _Farg0& _C_FARG1_FARG2>
250     {    // pointer to const volatile member fn
251     typedef _Rx _Type;
252     };
253
254  #ifdef _M_IX86
255 template<class _Rx,
256     _CLASS_ARG0
257     _C_CLASS_FARG0>
258     struct _RESULT_OF<_Rx (__cdecl _Arg0::*)(_ARG1_ARG2) const volatile,
259         _Farg0& _C_FARG1_FARG2>
260     {    // pointer to const volatile member fn
261     typedef _Rx _Type;
262     };
263
264 template<class _Rx,
265     _CLASS_ARG0
266     _C_CLASS_FARG0>
267     struct _RESULT_OF<_Rx (__stdcall _Arg0::*)(_ARG1_ARG2) const volatile,
268         _Farg0& _C_FARG1_FARG2>
269     {    // pointer to const volatile member fn
270     typedef _Rx _Type;
271     };
272
273   #ifndef _M_CEE
274 template<class _Rx,
275     _CLASS_ARG0
276     _C_CLASS_FARG0>
277     struct _RESULT_OF<_Rx (__fastcall _Arg0::*)(_ARG1_ARG2) const volatile,
278         _Farg0& _C_FARG1_FARG2>
279     {    // pointer to const volatile member fn
280     typedef _Rx _Type;
281     };
282   #endif /* _M_CEE */
283  #endif /* _M_IX86 */
284
285  #ifdef _M_CEE
286 template<class _Rx,
287     _CLASS_ARG0
288     _C_CLASS_FARG0>
289     struct _RESULT_OF<_Rx (__clrcall _Arg0::*)(_ARG1_ARG2) const volatile,
290         _Farg0& _C_FARG1_FARG2>
291     {    // pointer to const volatile member fn
292     typedef _Rx _Type;
293     };
294  #endif /* _M_CEE */
295
296     // TEMPLATE FUNCTION _RESULT_OF, const pointer to member fn
297 template<class _Rx,
298     _CLASS_ARG0
299     _C_CLASS_FARG0>
300     struct _RESULT_OF<_Rx (__thiscall _Arg0::*const)(_ARG1_ARG2),
301         _Farg0& _C_FARG1_FARG2>
302     {    // const pointer to member fn
303     typedef _Rx _Type;
304     };
305
306  #ifdef _M_IX86
307 template<class _Rx,
308     _CLASS_ARG0
309     _C_CLASS_FARG0>
310     struct _RESULT_OF<_Rx (__cdecl _Arg0::*const)(_ARG1_ARG2),
311         _Farg0& _C_FARG1_FARG2>
312     {    // const pointer to member fn
313     typedef _Rx _Type;
314     };
315
316 template<class _Rx,
317     _CLASS_ARG0
318     _C_CLASS_FARG0>
319     struct _RESULT_OF<_Rx (__stdcall _Arg0::*const)(_ARG1_ARG2),
320         _Farg0& _C_FARG1_FARG2>
321     {    // const pointer to member fn
322     typedef _Rx _Type;
323     };
324
325   #ifndef _M_CEE
326 template<class _Rx,
327     _CLASS_ARG0
328     _C_CLASS_FARG0>
329     struct _RESULT_OF<_Rx (__fastcall _Arg0::*const)(_ARG1_ARG2),
330         _Farg0& _C_FARG1_FARG2>
331     {    // const pointer to member fn
332     typedef _Rx _Type;
333     };
334   #endif /* _M_CEE */
335  #endif /* _M_IX86 */
336
337  #ifdef _M_CEE
338 template<class _Rx,
339     _CLASS_ARG0
340     _C_CLASS_FARG0>
341     struct _RESULT_OF<_Rx (__clrcall _Arg0::*const)(_ARG1_ARG2),
342         _Farg0& _C_FARG1_FARG2>
343     {    // const pointer to member fn
344     typedef _Rx _Type;
345     };
346  #endif /* _M_CEE */
347
348     // TEMPLATE FUNCTION _RESULT_OF, const pointer to const member fn
349 template<class _Rx,
350     _CLASS_ARG0
351     _C_CLASS_FARG0>
352     struct _RESULT_OF<_Rx (__thiscall _Arg0::*const)(_ARG1_ARG2) const,
353         _Farg0& _C_FARG1_FARG2>
354     {    // const pointer to const member fn
355     typedef _Rx _Type;
356     };
357
358  #ifdef _M_IX86
359 template<class _Rx,
360     _CLASS_ARG0
361     _C_CLASS_FARG0>
362     struct _RESULT_OF<_Rx (__cdecl _Arg0::*const)(_ARG1_ARG2) const,
363         _Farg0& _C_FARG1_FARG2>
364     {    // const pointer to const member fn
365     typedef _Rx _Type;
366     };
367
368 template<class _Rx,
369     _CLASS_ARG0
370     _C_CLASS_FARG0>
371     struct _RESULT_OF<_Rx (__stdcall _Arg0::*const)(_ARG1_ARG2) const,
372         _Farg0& _C_FARG1_FARG2>
373     {    // const pointer to const member fn
374     typedef _Rx _Type;
375     };
376
377   #ifndef _M_CEE
378 template<class _Rx,
379     _CLASS_ARG0
380     _C_CLASS_FARG0>
381     struct _RESULT_OF<_Rx (__fastcall _Arg0::*const)(_ARG1_ARG2) const,
382         _Farg0& _C_FARG1_FARG2>
383     {    // const pointer to const member fn
384     typedef _Rx _Type;
385     };
386   #endif /* _M_CEE */
387  #endif /* _M_IX86 */
388
389  #ifdef _M_CEE
390 template<class _Rx,
391     _CLASS_ARG0
392     _C_CLASS_FARG0>
393     struct _RESULT_OF<_Rx (__clrcall _Arg0::*const)(_ARG1_ARG2) const,
394         _Farg0& _C_FARG1_FARG2>
395     {    // const pointer to const member fn
396     typedef _Rx _Type;
397     };
398  #endif /* _M_CEE */
399
400     // TEMPLATE FUNCTION _RESULT_OF, const pointer to volatile member fn
401 template<class _Rx,
402     _CLASS_ARG0
403     _C_CLASS_FARG0>
404     struct _RESULT_OF<_Rx (__thiscall _Arg0::*const)(_ARG1_ARG2) volatile,
405         _Farg0& _C_FARG1_FARG2>
406     {    // const pointer to volatile member fn
407     typedef _Rx _Type;
408     };
409
410  #ifdef _M_IX86
411 template<class _Rx,
412     _CLASS_ARG0
413     _C_CLASS_FARG0>
414     struct _RESULT_OF<_Rx (__cdecl _Arg0::*const)(_ARG1_ARG2) volatile,
415         _Farg0& _C_FARG1_FARG2>
416     {    // const pointer to volatile member fn
417     typedef _Rx _Type;
418     };
419
420 template<class _Rx,
421     _CLASS_ARG0
422     _C_CLASS_FARG0>
423     struct _RESULT_OF<_Rx (__stdcall _Arg0::*const)(_ARG1_ARG2) volatile,
424         _Farg0& _C_FARG1_FARG2>
425     {    // const pointer to volatile member fn
426     typedef _Rx _Type;
427     };
428
429   #ifndef _M_CEE
430 template<class _Rx,
431     _CLASS_ARG0
432     _C_CLASS_FARG0>
433     struct _RESULT_OF<_Rx (__fastcall _Arg0::*const)(_ARG1_ARG2) volatile,
434         _Farg0& _C_FARG1_FARG2>
435     {    // const pointer to volatile member fn
436     typedef _Rx _Type;
437     };
438   #endif /* _M_CEE */
439  #endif /* _M_IX86 */
440
441  #ifdef _M_CEE
442 template<class _Rx,
443     _CLASS_ARG0
444     _C_CLASS_FARG0>
445     struct _RESULT_OF<_Rx (__clrcall _Arg0::*const)(_ARG1_ARG2) volatile,
446         _Farg0& _C_FARG1_FARG2>
447     {    // const pointer to volatile member fn
448     typedef _Rx _Type;
449     };
450  #endif /* _M_CEE */
451
452     // TEMPLATE FUNCTION _RESULT_OF, const pointer to const volatile member fn
453 template<class _Rx,
454     _CLASS_ARG0
455     _C_CLASS_FARG0>
456     struct _RESULT_OF<_Rx (__thiscall _Arg0::*const)(_ARG1_ARG2) const volatile,
457         _Farg0& _C_FARG1_FARG2>
458     {    // const pointer to const volatile member fn
459     typedef _Rx _Type;
460     };
461
462  #ifdef _M_IX86
463 template<class _Rx,
464     _CLASS_ARG0
465     _C_CLASS_FARG0>
466     struct _RESULT_OF<_Rx (__cdecl _Arg0::*const)(_ARG1_ARG2) const volatile,
467         _Farg0& _C_FARG1_FARG2>
468     {    // const pointer to const volatile member fn
469     typedef _Rx _Type;
470     };
471
472 template<class _Rx,
473     _CLASS_ARG0
474     _C_CLASS_FARG0>
475     struct _RESULT_OF<_Rx (__stdcall _Arg0::*const)(_ARG1_ARG2) const volatile,
476         _Farg0& _C_FARG1_FARG2>
477     {    // const pointer to const volatile member fn
478     typedef _Rx _Type;
479     };
480
481   #ifndef _M_CEE
482 template<class _Rx,
483     _CLASS_ARG0
484     _C_CLASS_FARG0>
485     struct _RESULT_OF<_Rx (__fastcall _Arg0::*const)(_ARG1_ARG2) const volatile,
486         _Farg0& _C_FARG1_FARG2>
487     {    // const pointer to const volatile member fn
488     typedef _Rx _Type;
489     };
490   #endif /* _M_CEE */
491  #endif /* _M_IX86 */
492
493  #ifdef _M_CEE
494 template<class _Rx,
495     _CLASS_ARG0
496     _C_CLASS_FARG0>
497     struct _RESULT_OF<_Rx (__clrcall _Arg0::*const)(_ARG1_ARG2) const volatile,
498         _Farg0& _C_FARG1_FARG2>
499     {    // const pointer to const volatile member fn
500     typedef _Rx _Type;
501     };
502  #endif /* _M_CEE */
503  #endif /* _NARGS != 0 */
504
505     // TEMPLATE CLASS _Result_of
506 template<class _Fty
507     _C_CLASS_ARG0>
508     struct _Result_of<_Fty __cdecl (_ARG0_ARG1)>
509     {    // generic result_of
510     typedef typename _RESULT_OF<_Fty _C_ARG0_ARG1_TO_REF>::_Type _Type;
511     };
512
513  #ifdef _M_CEE
514 template<class _Fty
515     _C_CLASS_ARG0>
516     struct _Result_of<_Fty __clrcall (_ARG0_ARG1)>
517     {    // generic result_of
518     typedef typename _RESULT_OF<_Fty _C_ARG0_ARG1_TO_REF>::_Type _Type;
519     };
520  #endif /* _M_CEE */
521
522 #undef _RESULT_OF
523 #undef _RESULT_TYPE
524
525 /*
526  * Copyright (c) 1992-2008 by P.J. Plauger.  ALL RIGHTS RESERVED.
527  * Consult your license regarding permissions and restrictions.
528 V5.05:0009 */
529