opIndexCall

Dan murpsoft at hotmail.com
Sat Mar 24 10:52:12 PDT 2007


I've recently discovered the want for an opIndexCall override in D.

For this:

struct Y {
  ...
  Y function() f;
}

struct X {
  char[][] keys;
  Y[] values;
  opIndex()
  opIndexAssign()
}

Y myF(){
  Y y;
  return y;
}


X z;

z["hello"] = &myF;

z["hello"](); // <-- can't do that.

Y function() a; // have to do this?
a = z["hello"];  // and this
a();                 // and this?



More information about the Digitalmars-d mailing list