Use .get() in MultiD Assoc Array?

Ali Çehreli acehreli at yahoo.com
Fri Aug 31 22:23:28 PDT 2012


On 08/31/2012 11:55 AM, Ali Çehreli wrote:

 > class MyTable

[...]

 > // Enables the 'auto element = myIndex in myTable' syntax

That's wrong. For that syntax to work, the operator below should have 
been opBinaryRight.

 > string * opBinary(string op)(Index index)

Yeah, that should have been opBinaryRight.

(And the badly designed Thunderbird removes the indentation in quoted 
text. Smart application or stupid designer?)

 > // Enables 'auto value = myTable[myIndex]'
 > ref string opIndex(Index index)
 > {
 > string * result = this.opBinary!"in"(index);

If I had defined opBinaryRight as I should have, then I could simply use 
the 'in' operator on the right-hand side:

         string * result = index in this;

 > Ali

Ali
"too"



More information about the Digitalmars-d-learn mailing list