On 8/21/21 10:33 AM, Jeremy T. Gibson wrote:

`typeid(class).name` always yields the full classname, including its module information (i.e., "modulename.classname"), where I only want "classname" on its own.

I've been reminded of __traits(identifier) on this forum just yesterday:

import std.stdio;

class Coo {

  string name() const {
    return __traits(identifier, typeof(this));
  }
}

void main() {
  auto c = new Coo();
  writeln(c.name());
}

Ali

Reply via email to