xxxxxxxxxx
/+ dub.sdl:
name "hello"
dependency "sumtype" version="~>0.4.1"
+/
import std.stdio;
import sumtype;
int main()
{
alias Item = SumType!(int, string);
Item[] items;
items ~= Item(5);
items ~= Item("text");
foreach(item; items)
{
item.match!(
( int num) => writeln("number: ", num),
(string str) => writeln("string: ", str),
);
}
return 0;
}