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);
194 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class D>
195 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10), D>
197 static bool const isMemberFunction = false;
199 typedef R ReturnType;
200 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9, TypeList<P10> > > > > > > > > > Params;
201 static R call (D fp, TypeListValues <Params>& tvl)
203 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, tvl.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
208 /* Non-const member function pointers. */
210 template <class T, class R, class D>
211 struct FuncTraits <R (T::*) (), D>
213 static bool const isMemberFunction = true;
214 static bool const isConstMemberFunction = false;
217 typedef R ReturnType;
219 static R call (T* obj, D fp, TypeListValues <Params>)
225 template <class T, class R, class P1, class D>
226 struct FuncTraits <R (T::*) (P1), D>
228 static bool const isMemberFunction = true;
229 static bool const isConstMemberFunction = false;
232 typedef R ReturnType;
233 typedef TypeList <P1> Params;
234 static R call (T* obj, D fp, TypeListValues <Params> &tvl)
236 return (obj->*fp)(tvl.hd);
240 template <class T, class R, class P1, class P2, class D>
241 struct FuncTraits <R (T::*) (P1, P2), D>
243 static bool const isMemberFunction = true;
244 static bool const isConstMemberFunction = false;
247 typedef R ReturnType;
248 typedef TypeList <P1, TypeList <P2> > Params;
249 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
251 return (obj->*fp)(tvl.hd, tvl.tl.hd);
255 template <class T, class R, class P1, class P2, class P3, class D>
256 struct FuncTraits <R (T::*) (P1, P2, P3), D>
258 static bool const isMemberFunction = true;
259 static bool const isConstMemberFunction = false;
262 typedef R ReturnType;
263 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
264 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
266 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
270 template <class T, class R, class P1, class P2, class P3, class P4, class D>
271 struct FuncTraits <R (T::*) (P1, P2, P3, P4), D>
273 static bool const isMemberFunction = true;
274 static bool const isConstMemberFunction = false;
277 typedef R ReturnType;
278 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
279 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
281 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
285 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class D>
286 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5), D>
288 static bool const isMemberFunction = true;
289 static bool const isConstMemberFunction = false;
292 typedef R ReturnType;
293 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
294 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
296 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd);
300 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
301 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6), D>
303 static bool const isMemberFunction = true;
304 static bool const isConstMemberFunction = false;
307 typedef R ReturnType;
308 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
309 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
311 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);
315 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
316 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7), D>
318 static bool const isMemberFunction = true;
319 static bool const isConstMemberFunction = false;
322 typedef R ReturnType;
323 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
324 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
326 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);
330 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
331 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8), D>
333 static bool const isMemberFunction = true;
334 static bool const isConstMemberFunction = false;
337 typedef R ReturnType;
338 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
339 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
341 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);
345 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>
346 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9), D>
348 static bool const isMemberFunction = true;
349 static bool const isConstMemberFunction = false;
352 typedef R ReturnType;
353 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
354 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
356 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);
360 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class D>
361 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10), D>
363 static bool const isMemberFunction = true;
364 static bool const isConstMemberFunction = false;
367 typedef R ReturnType;
368 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9, TypeList<P10> > > > > > > > > > Params;
369 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
371 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, tvl.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
376 /* Const member function pointers. */
378 template <class T, class R, class D>
379 struct FuncTraits <R (T::*) () const, D>
381 static bool const isMemberFunction = true;
382 static bool const isConstMemberFunction = true;
385 typedef R ReturnType;
387 static R call (T const* obj, D fp, TypeListValues <Params>)
393 template <class T, class R, class P1, class D>
394 struct FuncTraits <R (T::*) (P1) const, D>
396 static bool const isMemberFunction = true;
397 static bool const isConstMemberFunction = true;
400 typedef R ReturnType;
401 typedef TypeList <P1> Params;
402 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
404 return (obj->*fp)(tvl.hd);
408 template <class T, class R, class P1, class P2, class D>
409 struct FuncTraits <R (T::*) (P1, P2) const, D>
411 static bool const isMemberFunction = true;
412 static bool const isConstMemberFunction = true;
415 typedef R ReturnType;
416 typedef TypeList <P1, TypeList <P2> > Params;
417 static R call (T const* obj, R (T::*fp) (P1, P2) const,
418 TypeListValues <Params>& tvl)
420 return (obj->*fp)(tvl.hd, tvl.tl.hd);
424 template <class T, class R, class P1, class P2, class P3, class D>
425 struct FuncTraits <R (T::*) (P1, P2, P3) const, D>
427 static bool const isMemberFunction = true;
428 static bool const isConstMemberFunction = true;
431 typedef R ReturnType;
432 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
433 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
435 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
439 template <class T, class R, class P1, class P2, class P3, class P4, class D>
440 struct FuncTraits <R (T::*) (P1, P2, P3, P4) const, D>
442 static bool const isMemberFunction = true;
443 static bool const isConstMemberFunction = true;
446 typedef R ReturnType;
447 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
448 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
450 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
454 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class D>
455 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5) const, D>
457 static bool const isMemberFunction = true;
458 static bool const isConstMemberFunction = true;
461 typedef R ReturnType;
462 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
463 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
465 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd);
469 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
470 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6) const, D>
472 static bool const isMemberFunction = true;
473 static bool const isConstMemberFunction = true;
476 typedef R ReturnType;
477 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
478 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
480 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);
484 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
485 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7) const, D>
487 static bool const isMemberFunction = true;
488 static bool const isConstMemberFunction = true;
491 typedef R ReturnType;
492 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
493 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
495 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);
499 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
500 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8) const, D>
502 static bool const isMemberFunction = true;
503 static bool const isConstMemberFunction = true;
506 typedef R ReturnType;
507 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
508 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
510 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);
514 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>
515 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) const, D>
517 static bool const isMemberFunction = true;
518 static bool const isConstMemberFunction = true;
521 typedef R ReturnType;
522 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
523 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
525 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);
529 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class D>
530 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) const, D>
532 static bool const isMemberFunction = true;
533 static bool const isConstMemberFunction = true;
536 typedef R ReturnType;
537 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9, TypeList<P10> > > > > > > > > > Params;
538 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
540 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, tvl.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
545 #if defined (LUABRIDGE_THROWSPEC)
547 /* Ordinary function pointers. */
549 template <class R, class D>
550 struct FuncTraits <R (*) () LUABRIDGE_THROWSPEC, D>
552 static bool const isMemberFunction = false;
554 typedef R ReturnType;
556 static R call (D fp, TypeListValues <Params> const&)
562 template <class R, class P1, class D>
563 struct FuncTraits <R (*) (P1) LUABRIDGE_THROWSPEC, D>
565 static bool const isMemberFunction = false;
567 typedef R ReturnType;
568 typedef TypeList <P1> Params;
569 static R call (D fp, TypeListValues <Params>& tvl)
575 template <class R, class P1, class P2, class D>
576 struct FuncTraits <R (*) (P1, P2) LUABRIDGE_THROWSPEC, D>
578 static bool const isMemberFunction = false;
580 typedef R ReturnType;
581 typedef TypeList <P1, TypeList <P2> > Params;
582 static R call (D fp, TypeListValues <Params>& tvl)
584 return fp (tvl.hd, tvl.tl.hd);
588 template <class R, class P1, class P2, class P3, class D>
589 struct FuncTraits <R (*) (P1, P2, P3) LUABRIDGE_THROWSPEC, D>
591 static bool const isMemberFunction = false;
593 typedef R ReturnType;
594 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
595 static R call (D fp, TypeListValues <Params>& tvl)
597 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
601 template <class R, class P1, class P2, class P3, class P4, class D>
602 struct FuncTraits <R (*) (P1, P2, P3, P4) LUABRIDGE_THROWSPEC, D>
604 static bool const isMemberFunction = false;
606 typedef R ReturnType;
607 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
608 static R call (D fp, TypeListValues <Params>& tvl)
610 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
614 template <class R, class P1, class P2, class P3, class P4, class P5, class D>
615 struct FuncTraits <R (*) (P1, P2, P3, P4, P5) LUABRIDGE_THROWSPEC, D>
617 static bool const isMemberFunction = false;
619 typedef R ReturnType;
620 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
621 static R call (D fp, TypeListValues <Params>& tvl)
623 return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd);
627 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
628 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6) LUABRIDGE_THROWSPEC, D>
630 static bool const isMemberFunction = false;
632 typedef R ReturnType;
633 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
634 static R call (D fp, TypeListValues <Params>& tvl)
636 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);
640 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
641 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7) LUABRIDGE_THROWSPEC, D>
643 static bool const isMemberFunction = false;
645 typedef R ReturnType;
646 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
647 static R call (D fp, TypeListValues <Params>& tvl)
649 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);
653 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
654 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8) LUABRIDGE_THROWSPEC, D>
656 static bool const isMemberFunction = false;
658 typedef R ReturnType;
659 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
660 static R call (D fp, TypeListValues <Params>& tvl)
662 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);
666 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
667 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) LUABRIDGE_THROWSPEC, D>
669 static bool const isMemberFunction = false;
671 typedef R ReturnType;
672 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
673 static R call (D fp, TypeListValues <Params>& tvl)
675 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);
679 template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class D>
680 struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) LUABRIDGE_THROWSPEC, D>
682 static bool const isMemberFunction = false;
684 typedef R ReturnType;
685 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9, TypeList<P10> > > > > > > > > > Params;
686 static R call (D fp, TypeListValues <Params>& tvl)
688 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, tvl.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
692 /* Non-const member function pointers with THROWSPEC. */
694 template <class T, class R, class D>
695 struct FuncTraits <R (T::*) () LUABRIDGE_THROWSPEC, D>
697 static bool const isMemberFunction = true;
698 static bool const isConstMemberFunction = false;
701 typedef R ReturnType;
703 static R call (T* obj, D fp, TypeListValues <Params> const&)
709 template <class T, class R, class P1, class D>
710 struct FuncTraits <R (T::*) (P1) LUABRIDGE_THROWSPEC, D>
712 static bool const isMemberFunction = true;
713 static bool const isConstMemberFunction = false;
716 typedef R ReturnType;
717 typedef TypeList <P1> Params;
718 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
720 return (obj->*fp)(tvl.hd);
724 template <class T, class R, class P1, class P2, class D>
725 struct FuncTraits <R (T::*) (P1, P2) LUABRIDGE_THROWSPEC, D>
727 static bool const isMemberFunction = true;
728 static bool const isConstMemberFunction = false;
731 typedef R ReturnType;
732 typedef TypeList <P1, TypeList <P2> > Params;
733 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
735 return (obj->*fp)(tvl.hd, tvl.tl.hd);
739 template <class T, class R, class P1, class P2, class P3, class D>
740 struct FuncTraits <R (T::*) (P1, P2, P3) LUABRIDGE_THROWSPEC, D>
742 static bool const isMemberFunction = true;
743 static bool const isConstMemberFunction = false;
746 typedef R ReturnType;
747 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
748 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
750 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
754 template <class T, class R, class P1, class P2, class P3, class P4, class D>
755 struct FuncTraits <R (T::*) (P1, P2, P3, P4) LUABRIDGE_THROWSPEC, D>
757 static bool const isMemberFunction = true;
758 static bool const isConstMemberFunction = false;
761 typedef R ReturnType;
762 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
763 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
765 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
769 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class D>
770 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5) LUABRIDGE_THROWSPEC, D>
772 static bool const isMemberFunction = true;
773 static bool const isConstMemberFunction = false;
776 typedef R ReturnType;
777 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
778 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
780 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd);
784 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
785 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6) LUABRIDGE_THROWSPEC, D>
787 static bool const isMemberFunction = true;
788 static bool const isConstMemberFunction = false;
791 typedef R ReturnType;
792 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
793 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
795 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);
799 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
800 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7) LUABRIDGE_THROWSPEC, D>
802 static bool const isMemberFunction = true;
803 static bool const isConstMemberFunction = false;
806 typedef R ReturnType;
807 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
808 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
810 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);
814 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
815 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8) LUABRIDGE_THROWSPEC, D>
817 static bool const isMemberFunction = true;
818 static bool const isConstMemberFunction = false;
821 typedef R ReturnType;
822 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
823 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
825 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);
829 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>
830 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) LUABRIDGE_THROWSPEC, D>
832 static bool const isMemberFunction = true;
833 static bool const isConstMemberFunction = false;
836 typedef R ReturnType;
837 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
838 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
840 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);
844 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class D>
845 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) LUABRIDGE_THROWSPEC, D>
847 static bool const isMemberFunction = true;
848 static bool const isConstMemberFunction = false;
851 typedef R ReturnType;
852 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9, TypeList<P10> > > > > > > > > > Params;
853 static R call (T* obj, D fp, TypeListValues <Params>& tvl)
855 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, tvl.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
860 /* Const member function pointers with THROWSPEC. */
862 template <class T, class R, class D>
863 struct FuncTraits <R (T::*) () const LUABRIDGE_THROWSPEC, D>
865 static bool const isMemberFunction = true;
866 static bool const isConstMemberFunction = true;
869 typedef R ReturnType;
871 static R call (T const* obj, D fp, TypeListValues <Params>)
877 template <class T, class R, class P1, class D>
878 struct FuncTraits <R (T::*) (P1) const LUABRIDGE_THROWSPEC, D>
880 static bool const isMemberFunction = true;
881 static bool const isConstMemberFunction = true;
884 typedef R ReturnType;
885 typedef TypeList <P1> Params;
886 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
888 return (obj->*fp)(tvl.hd);
892 template <class T, class R, class P1, class P2, class D>
893 struct FuncTraits <R (T::*) (P1, P2) const LUABRIDGE_THROWSPEC, D>
895 static bool const isMemberFunction = true;
896 static bool const isConstMemberFunction = true;
899 typedef R ReturnType;
900 typedef TypeList <P1, TypeList <P2> > Params;
901 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
903 return (obj->*fp)(tvl.hd, tvl.tl.hd);
907 template <class T, class R, class P1, class P2, class P3, class D>
908 struct FuncTraits <R (T::*) (P1, P2, P3) const LUABRIDGE_THROWSPEC, D>
910 static bool const isMemberFunction = true;
911 static bool const isConstMemberFunction = true;
914 typedef R ReturnType;
915 typedef TypeList <P1, TypeList <P2, TypeList <P3> > > Params;
916 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
918 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd);
922 template <class T, class R, class P1, class P2, class P3, class P4, class D>
923 struct FuncTraits <R (T::*) (P1, P2, P3, P4) const LUABRIDGE_THROWSPEC, D>
925 static bool const isMemberFunction = true;
926 static bool const isConstMemberFunction = true;
929 typedef R ReturnType;
930 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4> > > > Params;
931 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
933 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd);
937 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class D>
938 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5) const LUABRIDGE_THROWSPEC, D>
940 static bool const isMemberFunction = true;
941 static bool const isConstMemberFunction = true;
944 typedef R ReturnType;
945 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5> > > > > Params;
946 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
948 return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd,
953 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class D>
954 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6) const LUABRIDGE_THROWSPEC, D>
956 static bool const isMemberFunction = true;
957 static bool const isConstMemberFunction = true;
960 typedef R ReturnType;
961 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6> > > > > > Params;
962 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
964 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);
968 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class D>
969 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7) const LUABRIDGE_THROWSPEC, D>
971 static bool const isMemberFunction = true;
972 static bool const isConstMemberFunction = true;
975 typedef R ReturnType;
976 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7> > > > > > > Params;
977 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
979 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);
983 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class D>
984 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8) const LUABRIDGE_THROWSPEC, D>
986 static bool const isMemberFunction = true;
987 static bool const isConstMemberFunction = true;
990 typedef R ReturnType;
991 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8> > > > > > > > Params;
992 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
994 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);
998 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>
999 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) const LUABRIDGE_THROWSPEC, D>
1001 static bool const isMemberFunction = true;
1002 static bool const isConstMemberFunction = true;
1004 typedef T ClassType;
1005 typedef R ReturnType;
1006 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
1007 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
1009 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);
1013 template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class D>
1014 struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) const LUABRIDGE_THROWSPEC, D>
1016 static bool const isMemberFunction = true;
1017 static bool const isConstMemberFunction = true;
1019 typedef T ClassType;
1020 typedef R ReturnType;
1021 typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9, TypeList<P10> > > > > > > > > > Params;
1022 static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
1024 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, tvl.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd);