Greetings,

I have been trying to get a working example of slice assignment operator overloading ... and am befuddled. From the spec (section 20.6.2), the
code below appears:

    struct A
    {
        int opIndexAssign(int v);  // overloads a[] = v
int opIndexAssign(int v, size_t[2] x); // overloads a[i .. j] = v int[2] opSlice(size_t x, size_t y); // overloads i .. j
    }

    void test()
    {
        A a;
        int v;

        a[] = v;  // same as a.opIndexAssign(v);
a[3..4] = v; // same as a.opIndexAssign(v, a.opSlice(3,4));
    }

I have hacked at this trying to get a simple working example. Could
anyone guide me here please?

Best Regards,
James

Reply via email to