On 4/24/21 6:50 PM, Jack wrote:
I'd like to output `K` and get this identifier at compile time.

This is solved by the "this template parameter":

import std.stdio;

class A {
  void showMyName(this T)() {
    writefln("name = [%s]", __traits(identifier, T));
  }
}

class K : A { }

void main() {
  new K().showMyName();
}

Ali

Reply via email to