bearophile wrote:
Yigal Chripun:
that is an implicit cast.
what I'm saying is that:

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

this should be a compiler error IMO.

I think the opposite is good: that empty collections are "false", so the 
following ones print X:

int[]  a;
if (!a) printf("X");
Set!(int) s;
if (!s) printf("X");
int[string] aa;
if (!aa) printf("X");

Bye,
bearophile

what's so bad about using a general collection.empty() API?
> int[]  a;
> if (!a.empty) printf("X");
> Set!(int) s;
> if (!s.empty) printf("X");
> int[string] aa;
> if (!aa.empty) printf("X");

what's more readable, my version or yours?

Reply via email to