Functional reflection

Classdesc provides metaprogramming reflection support for functional objects with the function.h header. Provided in the classdesc::functional namespace are the following metaprogramming templates:

Arity F has Arity<F>::V arguments
Return Return<F>::T is the return type of F
Arg Arg<F,i>::T is the type of the th argument of F
is_member_function_ptr is_member_function_ptr<F>::value is true if F is a member function pointer
is_nonmember_function_ptr is_nonmember_function_ptr<F>::value is true if F is a ordinary function pointer
is_function_ptr is_function_ptr<F>::value=true if F is either a member function pointer or an ordinary function pointer
void apply(R* r, F f, Args args); apply function f to an array of arguments

Metaprogramming datatypes will have either a static data member V or a typename T. In sympathy with classdesc's fairly compact style, we use these compact names rather than Boost's conventions of value and type. The is_ structure use value so as to be compatible with the use of enable_if (supplied in the classdesc.h header).

The apply function takes and array of arguments of type Args. Args can be a user defined type, but must be convertible to all the types used by F. An example type is defined in javaClass_base.h. The return object is passed as parameter r. This allows for the possibility of void returns, in which case apply ignores what is passed here (can pass NULL if F is known to have a void return type).