Function hasType
Tests if the algebraic type stores a value of a certain data type.
bool hasType(T, U)
(
scope const ref TaggedAlgebraic!U ta
);
bool hasType(T, U)
(
scope const TaggedAlgebraic!U ta
);
Example
union Fields {
int number;
string text;
}
TaggedAlgebraic!Fields ta = "test";
assert(ta .hasType!string);
assert(!ta .hasType!int);
ta = 42;
assert(ta .hasType!int);
assert(!ta .hasType!string);