Vtable for virtual functions in D

Kagamin spam at here.lot
Tue Apr 3 10:05:12 UTC 2018


On Wednesday, 7 March 2018 at 22:02:17 UTC, sarn wrote:
> When I wrote Xanthe a year ago, I rolled my own classes using 
> alias this and explicit vtables:
> https://gitlab.com/sarneaud/xanthe/blob/master/src/game/rigid_body.d#L15
> (I did this because normal D classes use the druntime library, 
> and Xanthe was an experiment in not using the D runtime at all.)

You can use address of vtable as type id. Unique and doesn't need 
CTFE.

alias TypeId=immutable(VTable*);
alias type_id=_vtable;


More information about the Digitalmars-d mailing list