vibe.d beta banner
get vibe.d
0.10.0

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

Function hasType

Tests if the algebraic type stores a value of a certain data type.

bool hasType(T, U) (
  in ref TaggedAlgebraic!U ta
);

bool hasType(T, U) (
  in 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);
Authors

Sönke Ludwig

Copyright

Copyright 2015-2019, Sönke Ludwig.

License

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