1 //------------------------------------------------------------------------------
3 https://github.com/vinniefalco/LuaBridge
5 Copyright 2012, Vinnie Falco <vinnie.falco@gmail.com>
7 License: The MIT License (http://www.opensource.org/licenses/mit-license.php)
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in all
17 copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 //==============================================================================
30 Since the throw specification is part of a function signature, the FuncTraits
31 family of templates needs to be specialized for both types. The
32 LUABRIDGE_THROWSPEC macro controls whether we use the 'throw ()' form, or
33 'noexcept' (if C++11 is available) to distinguish the functions.
35 #if defined (__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__clang__) || defined(__GNUC__) || \
36 (defined (_MSC_VER) && (_MSC_VER >= 1700))
37 // Do not define LUABRIDGE_THROWSPEC since the Xcode and gcc compilers do not
38 // distinguish the throw specification in the function signature.
40 // Visual Studio 10 and earlier pay too much mind to useless throw() spec.
42 # define LUABRIDGE_THROWSPEC throw()
45 //==============================================================================
47 Traits for function pointers.
49 There are three types of functions: global, non-const member, and const
50 member. These templates determine the type of function, which class type it
51 belongs to if it is a class member, the const-ness if it is a member
52 function, and the type information for the return value and argument list.
54 Expansions are provided for functions with up to 8 parameters. This can be
55 manually extended, or expanded to an arbitrary amount using C++11 features.
57 template <class MemFn, class D = MemFn>
62 /* Ordinary function pointers. */
64 template <class R, class D>
65 struct FuncTraits <R (*) (), D>
67 static bool const isMemberFunction = false;
71 static R call (D fp, TypeListValues <Params>)
77 template <class R, class P1, class D>
78 struct FuncTraits <R (*) (P1), D>
80 static bool const isMemberFunction = false;
83 typedef TypeList <P1> Params;
84 static R call (D fp, TypeListValues <Params>& tvl)
90 template <class R, class P1, class P2, class D>
91 struct FuncTraits <R (*) (P1, P2), D>
93 static bool const isMemberFunction = false;
96 typedef TypeList <P1, TypeList <P2> > Params;
97 static R call (D fp, TypeListValues <Params>& tvl)
99 return fp (tvl.hd, tvl.tl.hd);
103 template <class R, class P1, class P2, class P3, class D>
104 struct FuncTraits <R (*) (P1, P2, P3), D>
106 static bool const isMemberFunction = false;
108 typedef R ReturnType;
109 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
110 static R call (D fp, TypeListValues <Params>& tvl)
112 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
116 template <class R, class P1, class P2, class P3, class P4, class D>
117 struct FuncTraits <R (*) (P1, P2, P3, P4), D>
119 static bool const isMemberFunction = false;
121 typedef R ReturnType;
122 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
123 static R call (D fp, TypeListValues <Params>& tvl)
125 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
129 template <class R, class P1, class P2, class P3, class P4, class P5, class D>
130 struct FuncTraits <R (*) (P1, P2, P3, P4, P5), D>
132 static bool const isMemberFunction = false;
134 typedef R ReturnType;
135 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
136 static R call (D fp, TypeListValues <Params>& tvl)
138 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd);
142 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
143 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6), D>
145 static bool const isMemberFunction = false;
147 typedef R ReturnType;
148 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
149 static R call (D fp, TypeListValues <Params>& tvl)
151 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd);
155 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
156 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7), D>
158 static bool const isMemberFunction = false;
160 typedef R ReturnType;
161 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
162 static R call (D fp, TypeListValues <Params>& tvl)
164 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd);
168 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
169 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8), D>
171 static bool const isMemberFunction = false;
173 typedef R ReturnType;
174 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
175 static R call (D fp, TypeListValues <Params>& tvl)
177 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd);
181 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
182 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8, P9), D>
184 static bool const isMemberFunction = false;
186 typedef R ReturnType;
187 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
188 static R call (D fp, TypeListValues <Params>& tvl)
190 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
195 /* Non-const member function pointers. */
197 template <class T, class R, class D>
198 struct FuncTraits <R (T::*) (), D>
200 static bool const isMemberFunction = true;
201 static bool const isConstMemberFunction = false;
204 typedef R ReturnType;
206 static R call (T* obj, D fp, TypeListValues <Params>)
212 template <class T, class R, class P1, class D>
213 struct FuncTraits <R (T::*) (P1), D>
215 static bool const isMemberFunction = true;
216 static bool const isConstMemberFunction = false;
219 typedef R ReturnType;
220 typedef TypeList <P1> Params;
221 static R call (T* obj, D fp, TypeListValues <Params> &tvl)
223 return (obj->*fp)(tvl.hd);
227 template <class T, class R, class P1, class P2, class D>
228 struct FuncTraits <R (T::*) (P1, P2), D>
230 static bool const isMemberFunction = true;
231 static bool const isConstMemberFunction = false;
234 typedef R ReturnType;
235 typedef TypeList <P1, TypeList <P2> > Params;
236 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
238 return (obj->*fp)(tvl.hd, tvl.tl.hd);
242 template <class T, class R, class P1, class P2, class P3, class D>
243 struct FuncTraits <R (T::*) (P1, P2, P3), D>
245 static bool const isMemberFunction = true;
246 static bool const isConstMemberFunction = false;
249 typedef R ReturnType;
250 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
251 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
253 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
257 template <class T, class R, class P1, class P2, class P3, class P4, class D>
258 struct FuncTraits <R (T::*) (P1, P2, P3, P4), D>
260 static bool const isMemberFunction = true;
261 static bool const isConstMemberFunction = false;
264 typedef R ReturnType;
265 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
266 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
268 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
272 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class D>
273 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5), D>
275 static bool const isMemberFunction = true;
276 static bool const isConstMemberFunction = false;
279 typedef R ReturnType;
280 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
281 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
283 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd);
287 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
288 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6), D>
290 static bool const isMemberFunction = true;
291 static bool const isConstMemberFunction = false;
294 typedef R ReturnType;
295 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
296 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
298 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd);
302 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
303 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7), D>
305 static bool const isMemberFunction = true;
306 static bool const isConstMemberFunction = false;
309 typedef R ReturnType;
310 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
311 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
313 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd);
317 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
318 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8), D>
320 static bool const isMemberFunction = true;
321 static bool const isConstMemberFunction = false;
324 typedef R ReturnType;
325 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
326 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
328 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd);
332 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
333 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9), D>
335 static bool const isMemberFunction = true;
336 static bool const isConstMemberFunction = false;
339 typedef R ReturnType;
340 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
341 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
343 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
348 /* Const member function pointers. */
350 template <class T, class R, class D>
351 struct FuncTraits <R (T::*) () const, D>
353 static bool const isMemberFunction = true;
354 static bool const isConstMemberFunction = true;
357 typedef R ReturnType;
359 static R call (T const* obj, D fp, TypeListValues <Params>)
365 template <class T, class R, class P1, class D>
366 struct FuncTraits <R (T::*) (P1) const, D>
368 static bool const isMemberFunction = true;
369 static bool const isConstMemberFunction = true;
372 typedef R ReturnType;
373 typedef TypeList <P1> Params;
374 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
376 return (obj->*fp)(tvl.hd);
380 template <class T, class R, class P1, class P2, class D>
381 struct FuncTraits <R (T::*) (P1, P2) const, D>
383 static bool const isMemberFunction = true;
384 static bool const isConstMemberFunction = true;
387 typedef R ReturnType;
388 typedef TypeList <P1, TypeList <P2> > Params;
389 static R call (T const* obj, R (T::*fp) (P1, P2) const,
390 TypeListValues <Params>& tvl)
392 return (obj->*fp)(tvl.hd, tvl.tl.hd);
396 template <class T, class R, class P1, class P2, class P3, class D>
397 struct FuncTraits <R (T::*) (P1, P2, P3) const, D>
399 static bool const isMemberFunction = true;
400 static bool const isConstMemberFunction = true;
403 typedef R ReturnType;
404 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
405 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
407 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
411 template <class T, class R, class P1, class P2, class P3, class P4, class D>
412 struct FuncTraits <R (T::*) (P1, P2, P3, P4) const, D>
414 static bool const isMemberFunction = true;
415 static bool const isConstMemberFunction = true;
418 typedef R ReturnType;
419 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
420 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
422 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
426 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class D>
427 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5) const, D>
429 static bool const isMemberFunction = true;
430 static bool const isConstMemberFunction = true;
433 typedef R ReturnType;
434 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
435 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
437 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd);
441 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
442 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6) const, D>
444 static bool const isMemberFunction = true;
445 static bool const isConstMemberFunction = true;
448 typedef R ReturnType;
449 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
450 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
452 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd);
456 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
457 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7) const, D>
459 static bool const isMemberFunction = true;
460 static bool const isConstMemberFunction = true;
463 typedef R ReturnType;
464 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
465 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
467 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd);
471 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
472 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8) const, D>
474 static bool const isMemberFunction = true;
475 static bool const isConstMemberFunction = true;
478 typedef R ReturnType;
479 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
480 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
482 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd);
486 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
487 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) const, D>
489 static bool const isMemberFunction = true;
490 static bool const isConstMemberFunction = true;
493 typedef R ReturnType;
494 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
495 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
497 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
502 #if defined (LUABRIDGE_THROWSPEC)
504 /* Ordinary function pointers. */
506 template <class R, class D>
507 struct FuncTraits <R (*) () LUABRIDGE_THROWSPEC, D>
509 static bool const isMemberFunction = false;
511 typedef R ReturnType;
513 static R call (D fp, TypeListValues <Params> const&)
519 template <class R, class P1, class D>
520 struct FuncTraits <R (*) (P1) LUABRIDGE_THROWSPEC, D>
522 static bool const isMemberFunction = false;
524 typedef R ReturnType;
525 typedef TypeList <P1> Params;
526 static R call (D fp, TypeListValues <Params>& tvl)
532 template <class R, class P1, class P2, class D>
533 struct FuncTraits <R (*) (P1, P2) LUABRIDGE_THROWSPEC, D>
535 static bool const isMemberFunction = false;
537 typedef R ReturnType;
538 typedef TypeList <P1, TypeList <P2> > Params;
539 static R call (D fp, TypeListValues <Params>& tvl)
541 return fp (tvl.hd, tvl.tl.hd);
545 template <class R, class P1, class P2, class P3, class D>
546 struct FuncTraits <R (*) (P1, P2, P3) LUABRIDGE_THROWSPEC, D>
548 static bool const isMemberFunction = false;
550 typedef R ReturnType;
551 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
552 static R call (D fp, TypeListValues <Params>& tvl)
554 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
558 template <class R, class P1, class P2, class P3, class P4, class D>
559 struct FuncTraits <R (*) (P1, P2, P3, P4) LUABRIDGE_THROWSPEC, D>
561 static bool const isMemberFunction = false;
563 typedef R ReturnType;
564 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
565 static R call (D fp, TypeListValues <Params>& tvl)
567 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
571 template <class R, class P1, class P2, class P3, class P4, class P5, class D>
572 struct FuncTraits <R (*) (P1, P2, P3, P4, P5) LUABRIDGE_THROWSPEC, D>
574 static bool const isMemberFunction = false;
576 typedef R ReturnType;
577 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
578 static R call (D fp, TypeListValues <Params>& tvl)
580 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd);
584 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
585 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6) LUABRIDGE_THROWSPEC, D>
587 static bool const isMemberFunction = false;
589 typedef R ReturnType;
590 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
591 static R call (D fp, TypeListValues <Params>& tvl)
593 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd);
597 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
598 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7) LUABRIDGE_THROWSPEC, D>
600 static bool const isMemberFunction = false;
602 typedef R ReturnType;
603 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
604 static R call (D fp, TypeListValues <Params>& tvl)
606 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd);
610 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
611 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8) LUABRIDGE_THROWSPEC, D>
613 static bool const isMemberFunction = false;
615 typedef R ReturnType;
616 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
617 static R call (D fp, TypeListValues <Params>& tvl)
619 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd);
623 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
624 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) LUABRIDGE_THROWSPEC, D>
626 static bool const isMemberFunction = false;
628 typedef R ReturnType;
629 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
630 static R call (D fp, TypeListValues <Params>& tvl)
632 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
636 /* Non-const member function pointers with THROWSPEC. */
638 template <class T, class R, class D>
639 struct FuncTraits <R (T::*) () LUABRIDGE_THROWSPEC, D>
641 static bool const isMemberFunction = true;
642 static bool const isConstMemberFunction = false;
645 typedef R ReturnType;
647 static R call (T* obj, D fp, TypeListValues <Params> const&)
653 template <class T, class R, class P1, class D>
654 struct FuncTraits <R (T::*) (P1) LUABRIDGE_THROWSPEC, D>
656 static bool const isMemberFunction = true;
657 static bool const isConstMemberFunction = false;
660 typedef R ReturnType;
661 typedef TypeList <P1> Params;
662 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
664 return (obj->*fp)(tvl.hd);
668 template <class T, class R, class P1, class P2, class D>
669 struct FuncTraits <R (T::*) (P1, P2) LUABRIDGE_THROWSPEC, D>
671 static bool const isMemberFunction = true;
672 static bool const isConstMemberFunction = false;
675 typedef R ReturnType;
676 typedef TypeList <P1, TypeList <P2> > Params;
677 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
679 return (obj->*fp)(tvl.hd, tvl.tl.hd);
683 template <class T, class R, class P1, class P2, class P3, class D>
684 struct FuncTraits <R (T::*) (P1, P2, P3) LUABRIDGE_THROWSPEC, D>
686 static bool const isMemberFunction = true;
687 static bool const isConstMemberFunction = false;
690 typedef R ReturnType;
691 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
692 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
694 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
698 template <class T, class R, class P1, class P2, class P3, class P4, class D>
699 struct FuncTraits <R (T::*) (P1, P2, P3, P4) LUABRIDGE_THROWSPEC, D>
701 static bool const isMemberFunction = true;
702 static bool const isConstMemberFunction = false;
705 typedef R ReturnType;
706 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
707 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
709 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
713 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class D>
714 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5) LUABRIDGE_THROWSPEC, D>
716 static bool const isMemberFunction = true;
717 static bool const isConstMemberFunction = false;
720 typedef R ReturnType;
721 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
722 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
724 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd);
728 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
729 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6) LUABRIDGE_THROWSPEC, D>
731 static bool const isMemberFunction = true;
732 static bool const isConstMemberFunction = false;
735 typedef R ReturnType;
736 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
737 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
739 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd);
743 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
744 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7) LUABRIDGE_THROWSPEC, D>
746 static bool const isMemberFunction = true;
747 static bool const isConstMemberFunction = false;
750 typedef R ReturnType;
751 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
752 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
754 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd);
758 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
759 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8) LUABRIDGE_THROWSPEC, D>
761 static bool const isMemberFunction = true;
762 static bool const isConstMemberFunction = false;
765 typedef R ReturnType;
766 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
767 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
769 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd);
773 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
774 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) LUABRIDGE_THROWSPEC, D>
776 static bool const isMemberFunction = true;
777 static bool const isConstMemberFunction = false;
780 typedef R ReturnType;
781 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
782 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
784 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
789 /* Const member function pointers with THROWSPEC. */
791 template <class T, class R, class D>
792 struct FuncTraits <R (T::*) () const LUABRIDGE_THROWSPEC, D>
794 static bool const isMemberFunction = true;
795 static bool const isConstMemberFunction = true;
798 typedef R ReturnType;
800 static R call (T const* obj, D fp, TypeListValues <Params>)
806 template <class T, class R, class P1, class D>
807 struct FuncTraits <R (T::*) (P1) const LUABRIDGE_THROWSPEC, D>
809 static bool const isMemberFunction = true;
810 static bool const isConstMemberFunction = true;
813 typedef R ReturnType;
814 typedef TypeList <P1> Params;
815 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
817 return (obj->*fp)(tvl.hd);
821 template <class T, class R, class P1, class P2, class D>
822 struct FuncTraits <R (T::*) (P1, P2) const LUABRIDGE_THROWSPEC, D>
824 static bool const isMemberFunction = true;
825 static bool const isConstMemberFunction = true;
828 typedef R ReturnType;
829 typedef TypeList <P1, TypeList <P2> > Params;
830 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
832 return (obj->*fp)(tvl.hd, tvl.tl.hd);
836 template <class T, class R, class P1, class P2, class P3, class D>
837 struct FuncTraits <R (T::*) (P1, P2, P3) const LUABRIDGE_THROWSPEC, D>
839 static bool const isMemberFunction = true;
840 static bool const isConstMemberFunction = true;
843 typedef R ReturnType;
844 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
845 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
847 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
851 template <class T, class R, class P1, class P2, class P3, class P4, class D>
852 struct FuncTraits <R (T::*) (P1, P2, P3, P4) const LUABRIDGE_THROWSPEC, D>
854 static bool const isMemberFunction = true;
855 static bool const isConstMemberFunction = true;
858 typedef R ReturnType;
859 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
860 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
862 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
866 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class D>
867 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5) const LUABRIDGE_THROWSPEC, D>
869 static bool const isMemberFunction = true;
870 static bool const isConstMemberFunction = true;
873 typedef R ReturnType;
874 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
875 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
877 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd,
882 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
883 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6) const LUABRIDGE_THROWSPEC, D>
885 static bool const isMemberFunction = true;
886 static bool const isConstMemberFunction = true;
889 typedef R ReturnType;
890 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
891 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
893 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd);
897 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
898 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7) const LUABRIDGE_THROWSPEC, D>
900 static bool const isMemberFunction = true;
901 static bool const isConstMemberFunction = true;
904 typedef R ReturnType;
905 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
906 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
908 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd);
912 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
913 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8) const LUABRIDGE_THROWSPEC, D>
915 static bool const isMemberFunction = true;
916 static bool const isConstMemberFunction = true;
919 typedef R ReturnType;
920 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
921 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
923 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd);
927 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
928 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) const LUABRIDGE_THROWSPEC, D>
930 static bool const isMemberFunction = true;
931 static bool const isConstMemberFunction = true;
934 typedef R ReturnType;
935 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
936 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
938 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);