Mixin/static if issue
DLearner
bmqazwsx123 at gmail.com
Wed Aug 25 22:16:39 UTC 2021
Please see below:
```
void main() {
import std.stdio;
uint TestVar = 5;
string mxnWrite_Size_t(string VarName) {
static if (typeof(VarName).stringof == "uint") {
return `write("` ~ VarName ~ `");`;
} else {
return `writeln("Apparently TestVar not a uint");`;
}
}
mixin(mxnWrite_Size_t("TestVar"));
}
```
What I expected was the string "TestVar".
What I got was the "Apparently..." error message.
Please, why is this?
More information about the Digitalmars-d-learn
mailing list