Wouldn't it make a lot of sense to allow different opIndex implementations based on return type?

class myC {
        myT1 opIndex(int x)
        myT2 opIndex(int x)

Depending on the types involved myC[1] woudl return myT1 or myT2. Use-case: I have a geomentry object and in one case I get x0,y0,x1,y1 and in the other case x,y,w,h

IMO that would make a lot of sense.

Robert M. Münch
smarter | better | faster

Reply via email to