On Saturday, 13 November 2021 at 06:05:37 UTC, Stanislav Blinov
wrote:
On Saturday, 13 November 2021 at 05:31:51 UTC, forkit wrote:
Code below is self explanatory.
Any assistance on how to get the line number is welcome ;-)
https://dlang.org/spec/traits.html#getLocation
That?
Thanks. That seems to be the one, except:
writeln(__traits(getLocation, m)[1]); // nope. writes the line
no. of the foreach loop
writeln(__traits(getLocation, myClass)[1]); // yes, but I have to
provide the name manually here, which i would not know.
I would have thought m referred to myClass at this point in the
loop. But that doesn't seem to be the case.