Getting function argument names?
Sean Cavanaugh
WorksOnMyMachine at gmail.com
Wed Apr 20 13:05:30 PDT 2011
I am working on a template class to provide function wrappers for COM
based objects, so the calling code doesn't have to dereference the
underlying pointer. In C++ we get this behavior for 'free' by
overloading operator->. In D I can create a fairly funky mixin template
to inspect the contained class and auto-generate a bunch of wrapper
functions.
Its easy enough to get the function list, by looping on
__traits(getVirtualFunctions) for a class type, and feeding the results
into MemberFunctionsTuple!(). This needs to be followed up by repeating
the process for each base class specified , via BaseClassesTuple!().
So the real question:
Is there any way to get to the friendly names for function arguments
discovered through the traits system? MemberFunctionsTuple!() only
returns the types as far as i can tell, which technically is enough for
me to automatically name them something boring ArgA ArgB ArgC
procedurally, is not a very nice thing to look at.
More information about the Digitalmars-d-learn
mailing list