[Issue 14302] New style opSlice doesn't compile

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jun 1 18:58:07 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14302

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
If you want to use new integrated array operator overloading mechanism, you
should make the opSlice member function for i..j a template, like as:

    //Slice opSlice(size_t i, size_t j)     // NG
    Slice opSlice(size_t dim)(size_t i, size_t j)  // OK
    {
        Slice slice = Slice(i, j);
        return slice;
    }

After the rewriting, all tests will pass.

--


More information about the Digitalmars-d-bugs mailing list