How std.getopt would look with type functions

Stefan Koch uplink.coder at googlemail.com
Sun May 24 00:23:31 UTC 2020


On Sunday, 24 May 2020 at 00:15:07 UTC, Stefan Koch wrote:
>
> struct arg { string name; alias var; string help = null }
> getOps(args, arg("length", length),
>              arg("file", data),
>              arg("verbose", verbose),
>              arg("color", color, "Information about this color")
> );
>

Ah wrong args[]... have to go into the template parameter list.
At least for now. it would look more like
getOps!(arg("length", length),
        arg("file", data),
        arg("verbose", verbose),
        arg("color", color, "Information about this color"))(args);

The point still stands though.


More information about the Digitalmars-d mailing list