Testing derived type

Nick Sabalausky a at a.a
Sat Jul 5 17:55:24 PDT 2008


"Frank Benoit" <keinfarbton at googlemail.com> wrote in message 
news:g4opif$1fmn$1 at digitalmars.com...
> Koroskin Denis schrieb:
>
>> Or use
>>
>> ....
>> if ( elem.classinfo !is derivedA.classinfo ) {
>>     // do stuff
>> }
>> ....
>>
>> to skip derivedA instances only (and not derivatives).
>
> you can reuse the casted ref in the same if:
>
> if ( auto o = cast(derivedA)elem ) {
>     /* do stuff, use o */
> }
>

Ahh, thanks everyone.  Sometimes the obvious excapes me (as my boolean xor 
operator proposal in a different thread showed ;) ) 




More information about the Digitalmars-d-learn mailing list