Get class name of C++ class at runtime

Namespace via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 7 03:31:44 PDT 2016


On Thursday, 7 July 2016 at 09:59:23 UTC, Jacob Carlborg wrote:
> Is it possible to get the name of a C++ class, "extern(C++) 
> class Foo {}", at runtime just as it's possible to do the same 
> for a D class, like "object.classinfo.name"?

Maybe with a template?

----
void class_name(T)(T obj) if (is(T == class)) {
	writeln(T.stringof);	
}
----


More information about the Digitalmars-d-learn mailing list