[Issue 18405] New: std.getopt should support std.typecons.Flag out of the box

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 9 01:38:21 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18405

          Issue ID: 18405
           Summary: std.getopt should support std.typecons.Flag out of the
                    box
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: bootcamp
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: greensunny12 at gmail.com

I know that the following works already:

---
import std.getopt, std.typecons, std.stdio;
void main()
{
    auto args = ["foo", "-u"];
    alias U =Flag!"foo";
    U flag = U.no;
    getopt(args, "u", { flag = U.yes; }, );
    flag.writeln;
}
---

https://run.dlang.io/is/46u8Rx


But Flag is such a common type and "built-in" in Phobos, s.t. getopt should
really support it.

--


More information about the Digitalmars-d-bugs mailing list