On Monday, 29 May 2023 at 11:21:11 UTC, Adam D Ruppe wrote:
On Monday, 29 May 2023 at 09:35:11 UTC, John Xu wrote:Error: variable `column` cannot be read at compile timeyou should generally getMember on a variable T t; __traits(getMember, t, "name") like that, that's as if you wrote t.name
It seems I can't use variable as member name: struct T {int a; string name;} T t; string s = "name"; writeln(__traits(getMember, t, s)); Above code fails to compile. Any help?