opIndex overload for slice not working...

2016-01-24 Thread Enjoys Math via Digitalmars-d-learn
class V(T) { public: this() {} V opIndex(size_t i, size_t j) { writeln("Hello, foo!"); return this; } } main() { auto v = new V!int(); auto u = v[3..4];// ERROR } Error: no [] operator overload for type the_module.V!int

Re: opIndex overload for slice not working...

2016-01-24 Thread Ali Çehreli via Digitalmars-d-learn
On 01/24/2016 10:37 PM, Enjoys Math wrote: > class V(T) { > public: > this() {} > V opIndex(size_t i, size_t j) { > writeln("Hello, foo!"); > return this; > } > } > > main() { > auto v = new V!int(); > auto u = v[3..4];// ERROR > } > > Error: > no []

Re: opIndex overload for slice not working...

2016-01-24 Thread biozic via Digitalmars-d-learn
On Monday, 25 January 2016 at 06:37:13 UTC, Enjoys Math wrote: class V(T) { public: this() {} V opIndex(size_t i, size_t j) { writeln("Hello, foo!"); return this; } } main() { auto v = new V!int(); auto u = v[3..4];// ERROR } Error: no [] operator overload for