vibe.d beta banner
get vibe.d
0.10.0

Asynchronous I/O that doesn’t get in your way, written in D

Alias TypeOf

Maps a kind enumeration value to the corresponding field type.

alias TypeOf(alias kind) = ReplaceType!(This,U,FT);

kind must be a value of the TaggedAlgebraic!T.Kind enumeration.

Example

static struct S {
	int a;
	string b;
	string c;
}
alias TU = TaggedUnion!S;

static assert(is(TypeOf!(TU.Kind.a) == int));
static assert(is(TypeOf!(TU.Kind.b) == string));
static assert(is(TypeOf!(TU.Kind.c) == string));
Authors

Sönke Ludwig

Copyright

Copyright 2015-2019, Sönke Ludwig.

License

www.boost.org/LICENSE_1_0.txt, Boost License 1.0.