Re: Uniform call syntax for operator overloads

2010-07-27 Thread Daniel Keep
Tomek Sowiński wrote: > bearophile wrote: > >> Tomek S.: >> >>> This doesn't work: >>> int opIndex(int[][] m, uint i, uint j) { return m[i][j]; } >> That's cute, but in D overloaded operator can be defined inside >> structs/classes/unions only (this is different from C++). > > Yeah, I know, but

Re: Uniform call syntax for operator overloads

2010-07-25 Thread Tomek Sowiński
bearophile wrote: > Tomek S.: > >> This doesn't work: >> int opIndex(int[][] m, uint i, uint j) { return m[i][j]; } > > That's cute, but in D overloaded operator can be defined inside > structs/classes/unions only (this is different from C++). Yeah, I know, but why? What bad would happen if ope

Re: Uniform call syntax for operator overloads

2010-07-25 Thread bearophile
Tomek S.: > This doesn't work: > int opIndex(int[][] m, uint i, uint j) { return m[i][j]; } That's cute, but in D overloaded operator can be defined inside structs/classes/unions only (this is different from C++). Bye, bearophile

Uniform call syntax for operator overloads

2010-07-25 Thread Tomek Sowiński
This doesn't work: int opIndex(int[][] m, uint i, uint j) { return m[i][j]; } unittest { auto m = [[9,8], [2,3]]; auto a = m[0,1]; } It's so by design or by bug? Tomek p.s. Where on D page is uniform call syntax documented? Couldn't find it in functions section.