xxxxxxxxxx
import std.stdio, std.variant;
int main()
{
alias Item = Algebraic!(int, string);
Item[] items;
items ~= Item(5);
items ~= Item("text");
foreach(item; items)
{
item.visit!(
( int num) => writeln("number: ", num),
(string str) => writeln("string: ", str),
);
}
return 0;
}