Flag proposal

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Jun 10 10:41:02 PDT 2011


On 6/10/11, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> Without the cast, writeln prints "yes" or "no", which may be desirable.
> If you want to print the bool, you can say
>
> writeln(keepTerminator == Flag!"KeepTerminator".yes);
>
> or
>
> writeln(!!keepTerminator);
>

Oh, maybe this was already incorporated into format but I didn't
nocie, I just did a blunt copy/paste of the template code so it didn't
work for me:
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(1624): Error:
template std.format.formatValue(Writer,T,Char) if (is(const(T) ==
const(void[]))) formatValue(Writer,T,Char) if (is(const(T) ==
const(void[]))) matches more than one template declaration,
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(895):formatValue(Writer,T,Char)
if (is(T == enum)) and
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(1104):formatValue(Writer,T,Char)
if
(is(T : bool))


More information about the Digitalmars-d mailing list