how can i use the derive-hierarchy at runtime for typechecking?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Thu Sep 20 15:30:10 PDT 2007
"Chris Nicholson-Sauls" <ibisbasenji at gmail.com> wrote in message
news:fcupko$kh7$2 at digitalmars.com...
> void ifIs (S, T) (S obj, void delegate(T) dg) {
> if (auto casted = cast(T) obj) dg(casted);
> }
Or you could skip Downs' confusing way of writing code entirely ( ;) ) and
just use:
if(auto b = cast(B)foo)
{
// do stuff with b
}
More information about the Digitalmars-d-learn
mailing list