A SuperStruct!T constructed from the value at index.
pick is useful for something that is a floor wax _and_ a dessert topping:
struct FloorWax { string itIs() { return "a floor wax!"; } } struct DessertTopping { string itIs() { return "a dessert topping!"; } } auto shimmer(bool hungry) { return pick(hungry, FloorWax(), DessertTopping()); } assert(shimmer(false).itIs == "a floor wax!"); assert(shimmer(true ).itIs == "a dessert topping!");
Wrap one of several values in a SuperStruct.
This can be used to return a value from one of several different types. Similar to std.range.chooseAmong, but for a broader range of types.