You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to use the tag part of a tagged union on its own, and it would fit in well with the rest of std.variant.
It's not always the case that you want to store actual data, sometimes you just need to store the type. Also sometimes you need to store the data somewhere else or store it in such a way that you can specify the type first and fill in the data later.
eg.
alias TypeEnum!(
void,
byte,
short,
string,
Object
) TestTypeEnum;
TestTypeEnum test;
assert(test == TestTypeEnum.from!void);
assert(test != TestTypeEnum.from!byte);
test = TestTypeEnum.from!string;
assert(test == TestTypeEnum.from!string);
assert(test != TestTypeEnum.from!Object);
static assert(!__traits(compiles, TestTypeEnum.from!float));
(pull request shortly)
The text was updated successfully, but these errors were encountered:
diggsey reported this on 2013-05-21T01:24:15Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=10127
Description
It would be useful to use the tag part of a tagged union on its own, and it would fit in well with the rest of std.variant. It's not always the case that you want to store actual data, sometimes you just need to store the type. Also sometimes you need to store the data somewhere else or store it in such a way that you can specify the type first and fill in the data later. eg. alias TypeEnum!( void, byte, short, string, Object ) TestTypeEnum; TestTypeEnum test; assert(test == TestTypeEnum.from!void); assert(test != TestTypeEnum.from!byte); test = TestTypeEnum.from!string; assert(test == TestTypeEnum.from!string); assert(test != TestTypeEnum.from!Object); static assert(!__traits(compiles, TestTypeEnum.from!float)); (pull request shortly)The text was updated successfully, but these errors were encountered: