Replace (ie: substitute) a type in varadic args

Saurabh Das via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 2 00:24:28 PDT 2016


How can I substitute the type of an argument received via a 
varadic template?

For example say I want to generalise this scenario:

auto myConverterFunction1(bool arg1, bool arg2, ubyte arg3, int 
arg4)
{
     return targetFunction(cast(ubyte)arg1, cast(ubyte)arg2, arg3, 
arg4);
}

So I'll have something like:

auto myConverterFunction2(Args...)(Args args)
{
     // Don't know how to do this part...
}

Basically I need to substitute bool for ubyte to interface with 
the Java JNI.

Thanks,
Saurabh



More information about the Digitalmars-d-learn mailing list