fun with tuples/argument conversion function

Robert Fraser fraserofthenight at gmail.com
Fri May 11 13:47:09 PDT 2007


Hi all,

Right now I'm trying to write a function that, given an arbitrary number of arguments as D types concerts them into intermediate types that will be pasrd to the JNI. For example, given a char[], it will use the JNI to construct the relevant java.lang.string, and pass back the jobject.

The problem is that I can't define two tuples in the function template. For example, I can't write a function:
void dTypesToJavaTypes(InTypes..., OutTypes...)(InTypes inVars, out OutTypes outVars)

The number of in parameters will always be the same as the number of out parameters, and all the types should be known at compile-time, and though I'd rather not force the caller to know the out types, there's probably no way around that. Any suggestions? Maybe an out tuple and in varargs?


More information about the Digitalmars-d-learn mailing list