possible "solution" for ufcs
KennyTM~
kennytm at gmail.com
Mon Jun 6 12:43:03 PDT 2011
On Jun 7, 11 03:23, so wrote:
> I think something is missing here.
>
> It doesn't convert fun(int, ufcs) to ufcs.fun(int) as in the examples.
> It converts fun(ufcs, int) to ufcs.fun(int).
>
> We need is a solution to this:
>
> fun(T)(arg1, ... ufcs!T, ... argN)
auto ref opDispatch(string name, T...)(auto ref T args) {
mixin("alias ." ~ name ~ " f;");
alias ParameterTypeTuple!f Params;
enum i = staticIndexOf!(Unqual!(typeof(this)),
staticMap!(Unqual, Params));
static assert(i >= 0);
return f(args[0 .. i], this, args[i .. $]);
}
(Doesn't work with overload set though.)
More information about the Digitalmars-d
mailing list