Shows how to use hashtable alias.
#include <xtd/xtd>
auto main() -> int {
auto items = collections::hashtable {{"string", "42"}, {"int", 42}, {"time_span"_s, 12_h + 24_m + 42_s}, {"double", .42}, {"42", "string"}, {42, "int"}, {12_h + 24_m + 42_s, "time_span"}, {.42, "double"}};
for (auto [key, value] : items) {
console::write("{,-9} -> ", key);
if (is<string>(value)) console::write_line("{}", as<string>(value).quoted());
else if (is<int>(value)) console::write_line("0x{:X4}", as<int>(value));
else if (is<time_span>(value)) console::write_line("{} seconds", as<time_span>(value).seconds());
else console::write_line("{}", value);
}
console::write_line();
console::write_line("Update time_span to 20_h + 10_m + 5_s");
items["time_span"] = 20_h + 10_m + 5_s;
console::write_line("[time_span] = {}", items["time_span"]);
console::write_line("add day_of_week enum with day_of_week::saturday value");
items["day_of_week"] = day_of_week::saturday;
console::write_line("[day_of_week] = {}", items["day_of_week"]);
}