Created
October 9, 2023 02:55
-
-
Save crazymonkyyy/012c63e96aabed47fcb7787b0bc360a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std; | |
struct opindexopdispatch{ | |
int i=0; | |
auto opIndex(T...)(T args){ | |
struct op{ | |
opindexopdispatch* parent; | |
T args; | |
auto opDispatch(string op:"isnull",S...)(S args2){ | |
//pragma(msg,op,T,S); | |
return (*parent).opopdispatch!(T,op)(args,args2); | |
} | |
} | |
return op(&this,args); | |
} | |
void opopdispatch(I,I2,string op,T...)(I i,I2 i2,T args){ | |
//pragma(msg,op,T,"2d"); | |
import std; | |
writeln(op,";",args,";",T.stringof); | |
} | |
void opopdispatch(I,string op:"isnull",T...)(I i,T args){ | |
//pragma(msg,op,T,"1d"); | |
import std; | |
writeln(op,";",args,";",T.stringof); | |
} | |
} | |
unittest{ | |
opindexopdispatch foo; | |
foo[420,1337].isnull=true; | |
foo[420].isnull=true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment