Tweak n-ary mixin impelmentations

This commit is contained in:
monarchdodra 2014-01-11 15:59:43 +01:00
parent 31acdb075b
commit 6ceda934a2

View file

@ -42,8 +42,8 @@ template unaryFun(alias fun, string parmName = "a")
{ {
auto unaryFun(ElementType)(auto ref ElementType __a) auto unaryFun(ElementType)(auto ref ElementType __a)
{ {
mixin("alias __a "~parmName~";"); mixin("alias " ~ parmName ~ " = __a ;");
mixin("return (" ~ fun ~ ");"); return mixin(fun);
} }
} }
else else
@ -97,9 +97,9 @@ template binaryFun(alias fun, string parm1Name = "a",
auto binaryFun(ElementType1, ElementType2) auto binaryFun(ElementType1, ElementType2)
(auto ref ElementType1 __a, auto ref ElementType2 __b) (auto ref ElementType1 __a, auto ref ElementType2 __b)
{ {
mixin("alias __a "~parm1Name~";"); mixin("alias "~parm1Name~" = __a ;");
mixin("alias __b "~parm2Name~";"); mixin("alias "~parm2Name~" = __b ;");
mixin("return (" ~ fun ~ ");"); return mixin(fun);
} }
} }
else else