Operator overloading, structs

Yigal Chripun yigal100 at gmail.com
Thu Jun 4 00:06:45 PDT 2009


Andrei Alexandrescu wrote:
> Yigal Chripun wrote:
>> your abstraction inversion example doesn't apply here. The problem I 
>> see is the narrowing implicit cast, i.e. int values behave like 
>> booleans. I have no problem with the reverse which is what your 
>> example is about.
> 
> An int does not convert to bool implicitly. An int can be tested with 
> "if", which is a different thing.
> 
> Andrei

that is an implicit cast.
what I'm saying is that:

  int a = .. ;
  if (a) { .. }

this should be a compiler error IMO.



More information about the Digitalmars-d mailing list