std.sumtyp and option ?
kiriakov
itcraft.letter at gmail.com
Thu Jun 29 16:32:37 UTC 2023
On Thursday, 29 June 2023 at 15:19:45 UTC, Paul Backus wrote:
> On Thursday, 29 June 2023 at 14:18:05 UTC, kiriakov wrote:
> struct Option(T)
> {
> SumType!(None, Some!T) data;
> alias data this;
> this(Value)(Value value) { data = value; }
> }
>
> https://dlang.org/blog/2018/05/21/complicated-types-prefer-alias-this-over-alias-for-easier-to-read-error-messages/
Thanks, it's worked.
More information about the Digitalmars-d-learn
mailing list