https://d.puremagic.com/issues/show_bug.cgi?id=11737
--- Comment #6 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2013-12-15 12:30:23 PST --- (In reply to comment #3) > (In reply to comment #2) > > I think the default argument trick is quite neat. Andrej, would you care to > > implement it? > > I'm sure he'd love to implement it, but delegate and function pointer types > don't currently keep any information on the name or default value of their > parameters, meaning that this is currently impossible without declaring a > function and passing it as an alias template parameter. getopt is a variadic template, so it's possible to extract this information: ----- import std.traits; void getopt(T...)(ref string[] args, T opts) { static assert(ParameterDefaultValueTuple!(opts[1])[1] == "bar"); } void main(string[] args) { getopt(args, "log", (string option, string value = "bar") { }); } ----- -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------