how to determine a runtime type faster?

BCS BCS at pathlink.com
Thu May 10 08:32:29 PDT 2007


davidl wrote:
> umm , ur way rox either. but i don't know if the cast(derive)instance 
> is  implemented as good as
> (instance.classinfo is derive.classinfo)?
> 

another issue:

class A{}
class B:A{}
class C:B{}

A a = new C;
assert(cast(B)a !is null); // passes

The strongest and fastest check might be to compare the vtbl pointers. 
It will be a hack but it will be fast.



More information about the Digitalmars-d mailing list