But in this case, you need to know the ELs at compile-time. You can make them run-time values that way:
bool check(alias func, EL ...)(EL el) {
GError* err;
bool ok = func(el, &err);
if (!ok)
throw new Exception((*err).message);
return ok;
}
// used like:
check!fooXXX(arg1, ..., argN);
Of course, it'd be nice to check the EL at CT to see if they correspond to func parameters types. I don't know if you can do this with C functions, but for D funcs you can add:
import std.traits;
bool check(alias func, EL ...)(EL el) if (is(ParameterTypeTuple!func[0..$-1] == TypeTuple!(EL, GError*))
{
...
It's a bit strict, as it doesn't deal with implicit conversions.
Cheers,
Philippe