Mixin/static if issue
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Aug 25 22:33:00 UTC 2021
On Wed, Aug 25, 2021 at 10:16:39PM +0000, DLearner via Digitalmars-d-learn wrote:
> Please see below:
> ```
> void main() {
> import std.stdio;
>
> uint TestVar = 5;
>
> string mxnWrite_Size_t(string VarName) {
^^^^^^^^^^^^^^
Obviously, VarName is a string. Why would you expect anything else?
> static if (typeof(VarName).stringof == "uint") {
[[...]
I think what you meant to write is:
static if (typeof(mixin(VarName)).stringof == "uint") {
You want the type of the variable named by VarName, not the type of
VarName.
T
--
Many open minds should be closed for repairs. -- K5 user
More information about the Digitalmars-d-learn
mailing list