virtual method pointer

Steven Schveighoffer schveiguy at yahoo.com
Thu May 3 14:06:06 PDT 2012


On Thu, 03 May 2012 16:22:56 -0400, Gor Gyolchanyan  
<gor.f.gyolchanyan at gmail.com> wrote:

> That workaround is pretty obvious, but I can't afford to make an extra
> call every time. This event system is supposed to be ultra-fast. Isn't
> there a way to get to the vtable etry itself?

Well, you can use the ABI to determine the __vtbl location, but I'm not  
sure if there's a way in compile-time to get the __vtbl index to use.  I  
suppose you could iterate over the vtbl entries and find the function that  
matches.  It would be O(n) to construct the call function, but O(1) to  
call it.

-Steve


More information about the Digitalmars-d mailing list