Calling a d-style-variadic-function from another
tipdbmp
email at example.com
Sat Dec 30 10:14:35 UTC 2017
import core.vararg;
string foo(fmt, ...) {
int args_len = _arguments.length;
if (args_len == 1) {
if (typeid(_arguments[0] == typeid(TypeInfo[]))) {
_arguments = va_arg!(TypeInfo[])(_argptr);
args_len = _arguments.length;
// how can I adjust _argptr?
_argptr = ???
}
}
// using _arguments and va_arg!(X)(_argptr) here
return "not implemented";
}
void writef(string fmt, ...) {
// write(foo(fmt, ...)); // <-- doesn't work
// _arguments gets passed as a single argument of type
TypeInfo[]
write(foo(fmt, _arguments));
}
https://dlang.org/spec/function.html#d_style_variadic_functions
More information about the Digitalmars-d-learn
mailing list