get type name from current class at compile time?

Adam D. Ruppe destructionator at gmail.com
Sun Apr 25 08:36:51 UTC 2021


On Sunday, 25 April 2021 at 03:45:13 UTC, Jack wrote:
> that's better, thanks

Imporant to remember that any compile time thing will be the 
static type. If someone does:

Base a = new Derived();
a.something();

it will still show up as Base in the this template. The knowledge 
that it is actually a Derived thing is not there at compile time.

(well ok it kind of is, like the compiler's optimizer can still 
piece it together by following the flow, but it is no longer 
known to any template after that assignment.)


More information about the Digitalmars-d-learn mailing list