bool <=> int. WTF. (DIP0015)

Daniel Kozak kozzi11 at gmail.com
Wed Sep 18 08:13:24 UTC 2019


On Wed, Sep 18, 2019 at 10:06 AM Daniel Kozak <kozzi11 at gmail.com> wrote:
>
>
> You can do this on your own, just make your own Boolean type, or it
> could be added to Phobos, in theory it is there already:
> https://dlang.org/phobos/std_typecons.html#.Flag.Flag

import std.stdio;
import std.typecons;
alias MyBool = Flag!"mybool";
alias True = Flag!"mybool".yes;
alias False = Flag!"mybool".no;

void main()
{
    MyBool a = True;
    writeln(a);
}


More information about the Digitalmars-d mailing list