On Saturday, 25 July 2015 at 13:52:09 UTC, Andrei Alexandrescu wrote:
For one thing, it avoids the ugly hack which is the Flag template and
Yes/No structs.

With Flag:


The idiom goes like this.

/// Flag to control whether or not to keep line endings
alias KeepTerminator = Flag!"KeepTerminator";
///
string getLine(KeepTerminator KeepTerminator);

usage:

getLine(KeepTerminator.yes);
or
getLine(Yes.keepTerminator);

So named Boolean flags are a solved problem and are a good improvement over getLine(true) IMO.

Reply via email to