memoize (is this a fix for overloading?)

%u wfunction at hotmail.com
Tue Jan 4 15:11:36 PST 2011


It seems to me that this is an unsolvable problem without built-in compiler
support using __traits(getOverloads, Func), since without knowing all the
overloads of a function, you can't possibly write a template to widen the
arguments to the correct parameter types. (The current getOverloads needs a class
argument, but we need one without.)

Another solution would be another form of an "is" expression that gives you the
compile-time parameter type tuples of a called method, like:

static if (is(Func(args) ParamTypeTuple == function))
{ ... }

Then we can get the type tuples of the overload of the function *after* the
binding, rather than *before*.


More information about the Digitalmars-d mailing list