Safer casts

Janice Caron caron800 at googlemail.com
Fri May 9 10:29:37 PDT 2008


On 09/05/2008, BCS <BCS at pathlink.com> wrote:
>  The major issue I have with this is that the construct that actually does
> the downcast MUST also do the type check. Therefor it gets done twice and
> this is  a bit of a performance issue.

Good point.

>  I'd rather see a testClass!(T) version that acts exactly like the current
> cast and a isClass!(T) that acts like your class!(T).

OK, so how about just making class!(T) return null, and do away with
is!(T)? That's what C++ does with dynamic_cast<T>, after all.



More information about the Digitalmars-d mailing list