Problem with templates
Sean Reque
seanthenewt at yahoo.com
Mon Jul 7 11:51:04 PDT 2008
Thanks BCS. What you gave me was sufficient to make the function. I could not find and did not take the time to right the function IsFunction, but here is the working function in phobos.
ReturnType!(S) delegate(ParameterTypeTuple!(F)) my_compose(F, S)(F first, S second)
{
//no equivalent of IsAFunctionType in phobos
//static assert(IsAFunctionType!(F)); // this might do better as a constraint
//static assert(IsAFunctionType!(S));
return delegate ReturnType!(S)(ParameterTypeTuple!(F) args) { return second(first(args)); } ;
}
It's too bad that the using typesafe variadics didn't work, as that solution seems cleaner, but i am very happy to find at least one way to get it to work.
Sean
More information about the Digitalmars-d-learn
mailing list