rtti cast

BCS BCS at pathlink.com
Wed May 7 07:29:34 PDT 2008


terranium wrote:
> downs Wrote:
> 
> 
>>As such, an exception (which is reserved, appropriately, for *exceptional* events), is totally the wrong approach to use.
>>
> 
> Yes, function received wrong input, this is normal, if we want, we throw exception, if we want, we ignore it.
> 

The point is that offtent a failed cast is not an indecation of an 
error. For instance code like this

class A {}
class B1 : A {}
class B2 : A {}

void foo(A a)
{
   if(auto b = cast(B1)a) {}
   else if(auto b = cast(B2)a) {}
   else {}
}



More information about the Digitalmars-d mailing list