Dynamic property storage. Note: This member is public on purpose.
set/get
import std.exception : assertThrown; auto props = Properties("props"); props["name"] = "hello"; assert(props["name"].get!string() == "hello"); props["custom"] = 1337; assert(props["custom"].get!int() == 1337); props["asdfghjkl"] = 42; assert(props["asdfghjkl"].convertsTo!int()); assert(props["asdfghjkl"].get!int() == 42); //struct IntValue { int value; } //assert(props["asdfghjkl"].coerce!IntValue().value == 42); assertThrown!MissingKeyError(props["iDontExist"].get!float()); assert(props.tryGet("iDontExist", null) is null); { Property fallback; assert(props.tryGet("iDontExist", &fallback) == &fallback); } // Overwrite. props["name"] = "world"; assert(props["name"].get!string() == "world");