Is std.variant.visit not @nogc?
Paul Backus
snarwin at gmail.com
Tue Apr 10 16:59:02 UTC 2018
On Tuesday, 10 April 2018 at 12:34:07 UTC, aliak wrote:
> Awesome!
>
> this is a neat trick:
>
> union
> {
> AliasSeq!(T0, T1) values;
> }
>
> Is that usage documented somewhere, or is it somewhere in
> phobos maybe?
>
> Also, can Algebraic be fully replaced with this version then or
> is there some functionality that would stop it going through?
It's called "type sequence instantiation", and it's documented in
the "Compile-time Sequences" article [1] on dlang.org. I
discovered it reading the source of the 'tagged_union' dub
package [2]. It's not mentioned anywhere in the language spec, as
far as I can tell.
SumType should be capable of doing anything that Algebraic can do
(if it's not, please open an issue on Github!), but it's not a
drop-in replacement, and it's still a work in progress.
Documentation for the current version (more or less) is available
at http://sumtype.dpldocs.info/index.html. If there are any
particular features you'd like to see, let me know, and I'll do
my best to add them.
[1]
https://dlang.org/articles/ctarguments.html#type-seq-instantiation
[2]
https://github.com/Superstar64/tagged_union/blob/master/source/tagged_union.d
More information about the Digitalmars-d-learn
mailing list