digitalmars.D - arrays with non-int indexes
- Bent Rasmussen (23/23) Jun 15 2004 I didn't dare hope that this would compile
- Norbert Nemec (13/24) Jun 16 2004 Actually, after the recent introduction of opIndexAssign, this will have...
I didn't dare hope that this would compile class A { float opIndex(float k) { return k; } float opIndex(float k, float v) { return k; } } I have to say that this is cool! If at some point in the future I can also do e.g. class A { float opIndex(float k1, float k2, float k3) { ... } float opIndex(float k1, float k2, float k3, float v) { ... } ... } That'll be awesome! Not to speak of slicing...
Jun 15 2004
Bent Rasmussen wrote:I didn't dare hope that this would compile class A { float opIndex(float k) { return k; } float opIndex(float k, float v) { return k; } }Actually, after the recent introduction of opIndexAssign, this will have to be: class A { float opIndex(float k) { return k; } float opIndexAssign(float v, float k) { return k; } } (Not sure about the final resolution about the ordering of the arguments.)
Jun 16 2004