On Saturday, 6 May 2017 at 08:34:11 UTC, k-five wrote:

Also what is the parameter "a.empty" for template filter

Jonathan covered the type part. As for that last bit, the filter template takes a predicate as parameter. This predicate is called for each input element, and if returns false, the element is ignored. The predicate can be a function, or, for example, a lambda:

auto input = args[1].splitter('/').filter!((string s) { return !s.empty; })();

or a template lambda:

auto input = arga[1].splitter('/').filter!((s) => !s.empty)();

By convention, predicates in Phobos can also be compile-time strings. In that case, std.functional.unaryFun is used to turn that string into a function. By default, unaryFun names the argument 'a', so the "!a.empty" will be expanded by unaryFun into (a) => !a.empty.

Reply via email to