this work
class Bind(alias indeces)
{
static if(is(typeof(indeces) : int[]))
{
static auto opCall(D,V...)(D dg,V values)
{
static if(is(D d : R delegate(U), R, U...) &&
is(V == Combination!(indeces,ParameterTypeTuple!D)))
{
static if(indeces.length > 1)
return Bind!(update!(indeces,indeces[0])[1..$])(Curry!(indeces[0])(dg,values[0]),values[1..$]);
else
return Curry!(indeces[0])(dg,values[0]);
}
}
}
}
while this doesn't work
class Bind(alias indeces)
{
static if(is(typeof(indeces) : int[]))
{
static auto opCall(R,U...)(R delegate(U) dg,Combination!(U) values)
{
static if(indeces.length > 1)
return Bind!(update!(indeces,indeces[0])[1..$])(Curry!(indeces[0])(dg,values[0]),values[1..$]);
else
return Curry!(indeces[0])(dg,values[0]);
}
}
}
Comment #1 by hsteoh — 2019-02-06T22:51:40Z
Tested on latest DMD (v2.084.0-395-gcb3a72613). Could not reproduce problem.
Please provide more details, what does it mean "does not work"? Compile error? Runtime error? Wrong semantics?
Also, please provide a full compilable/runnable code, since from the given code it's not clear which instantiation parameters causes it to fail.
Comment #2 by robert.schadek — 2024-12-13T18:00:19Z