defining "in" What is the proper way in D2?
David Nadlinger
see at klickverbot.at
Sun Sep 11 14:22:56 PDT 2011
On 9/11/11 11:12 PM, Jonathan M Davis wrote:
> The "in" operator normally returns a pointer to the value that you're trying
> to find (and returns null if it's not there). Making it return bool may work,
> but it's going to be a problem for generic code. That's like making
> opBinary!"*" return a type different than the types being multiplied. It's just
> not how the operator is supposed to be used and could cause problems.
>
> - Jonathan M Davis
+1, I once ran into a bug because of which I used bool instead, but that
one should be fixed since quite some time now.
David
More information about the Digitalmars-d-learn
mailing list