[Issue 16302] Add opStaticIndex that takes compile-time indices
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 20 13:15:54 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16302
Danila Letunovskiy <kapblc at mail.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kapblc at mail.ru
--- Comment #2 from Danila Letunovskiy <kapblc at mail.ru> ---
Yeah and opStaticBinary and opStaticAssign and opStaticEquals ;D
struct Enum(T) {
T n;
opStaticAssign(string s)(){ return n = s.to!T; }
opStaticEqual(string s)(){ return n == s.to!T; }
}
enum Color { red, green, blue }
Enum!Color c = "red";
if(c == "red"){
}
--
More information about the Digitalmars-d-bugs
mailing list