The in operator and normal arrays

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Apr 27 10:59:45 PDT 2007


Myron Alexander wrote:
> I was in the process of writing the enhancement request when I had a 
> quick peek at the documentation. The operator overloading document 
> specifically allows for overloading the in operator with opIn and opIn_r 
> (although doesn't say how it is supposed to be used). This got me 
> thinking, is this an enhancement request, or a bug fix request?

You can only overload operators on structs and classes (and perhaps 
unions). You can't overload operators purely on built-in types and arrays.

(You /could/ overload it separately for every aggregate type you 
implement, but then it still won't work for arrays of primitive types, 
or arrays of arrays)



More information about the Digitalmars-d mailing list