Operator overloading, structs

bearophile bearophileHUGS at lycos.com
Tue Jun 9 08:37:47 PDT 2009


Leandro Lucarella:
> I think the more general solution is to allow multiple implicit cast
> operators and simply provide implicit conversion to bool for the classes
> you want to be able to do if (x) on.

Yes, that's a more general solution, but I think Don thinks that solution is also less safe.
I don't have enough experience on this to be able to tell, but generally the less invisible magic there is, the more clear the programs are. So better to limit the magic the few places where it's very useful (and where people know very well it can be present).

Bye,
bearophile



More information about the Digitalmars-d mailing list