A switch/case too far...

terranium spam at here.lot
Thu May 22 03:35:09 PDT 2008


Janice Caron Wrote:

> I like the following idea: if the case statement specifies a type,
> check that the object can be implicitly cast to that type; if the case
> statement specifies a value, check for equality. So:
> 
>     switch(typeof(a))
>     {
>         case B1: // RTTI dynamic cast test
>             // ...
> 
>         case B2:
>             // ...
>     }
> 
there is no need for RTTI for *implicit* cast.



More information about the Digitalmars-d mailing list