Status of $ in class/struct?

Nick Sabalausky a at a.a
Tue Mar 29 19:29:21 PDT 2011


I haven't been following the $/__dollar/opDollar/etc chronicles very 
closely, and I can't find the answer in the docs, but I have simple 
question:

Suppose I have this:

-------------------------------
class Foo
{
    int[] data;

    this(int[] data)
    {
        this.data = data;
    }

    ref T opIndex(size_t i)
    {
        return data[i];
    }
}

void main()
{
    auto foo = Foo([1,2,3,4,5]);
    ...
}
-------------------------------

Question:

Is there currently any way for Foo's author to make "foo[$-1]" work? If so, 
how?





More information about the Digitalmars-d-learn mailing list