On Tuesday, February 13, 2018 01:55:59 Marc via Digitalmars-d-learn wrote:
> Thanks for you always well-thought-out answer. I was going to
> print it with writefln() calls more than anywhere else so to
> avoid casts in all those places, which would make it ugly, I just
> used
>
> > enum foo = "a";
On Monday, 12 February 2018 at 17:29:47 UTC, Jonathan M Davis
wrote:
On Monday, February 12, 2018 17:07:50 Marc via
Digitalmars-d-learn wrote:
[...]
If you actually use the enum values anywhere other than with
anything from std.conv, std.format, or std.stdio, then when
they get converted to
On Monday, February 12, 2018 17:07:50 Marc via Digitalmars-d-learn wrote:
> If I have an enum like this:
> > enum S : string {
> >
> > foo = "a",
> > baa = "b"
> >
> >}
>
> when I printed it, to my surprise I get the enum field name
>
> rather value:
> > writefln("%s v%s", S.foo, S.baa);
>
>
If I have an enum like this:
enum S : string {
foo = "a",
baa = "b"
}
when I printed it, to my surprise I get the enum field name
rather value:
writefln("%s v%s", S.foo, S.baa);
output:
foo vbaa
instead of
a vb
a cast solves it but without cast everywhere I