What's wrong with std.variant.Variant?
Paolo Invernizzi
paolo.invernizzi at gmail.com
Mon Jun 15 06:27:57 UTC 2020
On Sunday, 14 June 2020 at 18:04:57 UTC, Paul Backus wrote:
> On Sunday, 14 June 2020 at 17:31:32 UTC, Dukc wrote:
>> [...]
>
> FYI, SumType works with nothrow and @nogc, and can solve all of
> your other problems with std.variant as well. :)
>
> Duplicate types are not supported out-of-the-box, but can very
> easily be accomplished using `std.typecons.Typedef`:
>
> alias InPixels = Typedef!(int[2], int[2].init, "InPixels");
> alias InMeters = Typedef!(float[2], float[2].init,
> "InMeters");
> alias SourceSizes = Typedef!(float[2], float[2].init,
> "SourceSizes");
> alias PictureSize = SumType!(InPixels, InMeters,
> SourceSizes);
+1
We are using sumtype instead of std.variant exactly for that,
attributes are not working with std.variant, and that's a show
stopper.
/P
More information about the Digitalmars-d
mailing list