Make enum auto castable
Mike B Johnson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jun 4 17:16:15 PDT 2017
On Sunday, 4 June 2017 at 23:39:11 UTC, Jonathan M Davis wrote:
> On Sunday, June 04, 2017 22:52:55 Mike B Johnson via
> Digitalmars-d-learn wrote:
>> [...]
>
> Aside from whatever implicit conversions are built into the
> language, the only way to define an implicit conversion in D is
> via alias this on a user-defined type, which then tells that
> type that it can convert to whatever type the result of the
> alias this is. e.g. if you have
>
> [...]
I might be able to change the enum, I assume you mean something
like
enum myenum : S { }
where S is the struct that implicitly converts?
More information about the Digitalmars-d-learn
mailing list