vtbl jamming

BCS ao at pathlink.com
Mon Sep 10 08:03:52 PDT 2007


Reply to Vladimir,

> On Mon, 10 Sep 2007 09:40:59 +0300, BCS <ao at pathlink.com> wrote:
> 
>> can we get some way to do this?
>> 
>> http://www.artima.com/cppsource/backyard2.html
>> 
> Modifying VTBLs is effectively the same as using method pointers (as a
> static field). The advantage is when we don't have access to the base
> class. Of course, D doesn't have method pointers (like C++), so...
> 

The first use case that came to mind for me was a caching system. The first 
constructed object is a proxy with no data in it. The first time you ask 
for data, the data gets loaded and then the type gets switched so only a 
simple get is done next time. No ifs  needed.





More information about the Digitalmars-d mailing list