How std.getopt would look with type functions
Adam D. Ruppe
destructionator at gmail.com
Sun May 24 13:00:40 UTC 2020
On Sunday, 24 May 2020 at 07:06:31 UTC, Stefan Koch wrote:
> Yes but that's no reason to not show how it would look?
getopt(
arg("whatever", "help", whatever),
arg("other", other)
);
It is identical to what you wrote except with implicit template
args. getopt there is still a variadic template, arg is a factory
function (with two overloads, with and without the help string)
that returns a templated struct. The getopt is free to static
assert fail if an argument isn't of the typeof(arg).
The final arg is either an explicit pointer or a ref argument
that takes the address internally for the return value.
No fancy feature needed here.
More information about the Digitalmars-d
mailing list