www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18405] New: std.getopt should support std.typecons.Flag out


          Issue ID: 18405
           Summary: std.getopt should support std.typecons.Flag out of the
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: bootcamp
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greensunny12 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; }, );


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

Feb 08 2018