April 03, 2018 Re: Vtable for virtual functions in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to sarn | 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;
|
Copyright © 1999-2021 by the D Language Foundation