Torque 3D 3.8
ContentsIndexHome
PreviousUpNext
fastdelegate Namespace

General tricks used in this code 

(a) Error messages are generated by typdefing an array of negative size to generate compile-time errors. (b) Warning messages on MSVC are generated by declaring unused variables, and enabling the "variable XXX is never used" warning. (c) Unions are used in a few compiler-specific cases to perform illegal casts. (d) For Microsoft and Intel, when adjusting the 'this' pointer, it's cast to (char *) first to ensure that the correct number of *bytes* are added. 

///////////////////////////////////////////////////////////////////////////// Helper templates

Name 
Description 
An outer class, FastDelegateN<>, handles the invoking and creates the necessary typedefs. This class does everything else. 
Name 
Description 
The following table lists classes in this documentation. 
The following table lists macros in this documentation. 
 
Name 
Description 
 
DelegateMemento - Evil version
For compilers where data pointers are at least as big as code pointers, it is possible to store the function pointer in the this pointer, using another horrible_cast. In this case the DelegateMemento implementation is simple: +--pThis --+-- pMemFunc-+-- Meaning---------------------+ | 0 | 0 | Empty | | !=0 | !=0* | Static function or method call| +----------+------------+-------------------------------+
  • For Metrowerks, this can be 0. (first virtual function in a single_inheritance class).
Note that the Sun C++ and MSVC documentation explicitly state that they support static_cast between void * and function pointers. 
 
N=0 Specialization to allow use of FastDelegate< R ( ) > instead of FastDelegate0 < R > 
 
N=1 Specialization to allow use of FastDelegate< R ( Param1 ) > instead of FastDelegate1 < Param1, R > 
 
N=2 Specialization to allow use of FastDelegate< R ( Param1, Param2 ) > instead of FastDelegate2 < Param1, Param2, R > 
 
N=3 Specialization to allow use of FastDelegate< R ( Param1, Param2, Param3 ) > instead of FastDelegate3 < Param1, Param2, Param3, R > 
 
N=4 Specialization to allow use of FastDelegate< R ( Param1, Param2, Param3, Param4 ) > instead of FastDelegate4 < Param1, Param2, Param3, Param4, R > 
 
N=5 Specialization to allow use of FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) > instead of FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > 
 
N=6 Specialization to allow use of FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) > instead of FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > 
 
N=7 Specialization to allow use of FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) > instead of FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > 
 
N=8 Specialization to allow use of FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) > instead of FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > 
 
N=11 Specialization to allow use of FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11 ) > instead of FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R > 
 
N=12 Specialization to allow use of FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12 ) > instead of FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R > 
 
N=13 Specialization to allow use of FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13 ) > instead of FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R > 
 
N=0 
 
N=1 
 
N=11 
 
N=12 
 
N=13 
 
N=2 
 
N=3 
 
N=4 
 
N=5 
 
N=6 
 
N=7 
 
N=8 
Name 
Description 
Workaround for VC6. VC6 needs void return types converted into DefaultVoid. GCC 3.2 and later won't compile this unless it's preceded by 'typename', but VC6 doesn't allow 'typename' in this context. So, I have to use a macro. 
Copyright (c) 2015. All rights reserved.
What do you think about this topic? Send feedback!