Test for element in array

Paolo Invernizzi arathorn at NOSPAM_fastwebnet.it
Fri Jul 14 00:51:43 PDT 2006


BCS wrote:

> the semantics are backwards, not a killer but its a little inconsistent.
> 
> With aa, the type of the LHS is the type of the index
> 
> if(a in b) b[a]; // valid
> 
> with non-aa, the type of the LHS would be the type of the stored value. 
> The above wont always work for a non-aa. Also which a in b is found? The 
> first? An array of all? The last?

I would be satisfied also if it just returns a boolean value, like a 
simple inclusion test...

But for now, I will use the BCS solutions! Thanks!

---
Paolo




More information about the Digitalmars-d-learn mailing list