IndexExpression

Jarrett Billingsley jarrett.billingsley at gmail.com
Mon Jan 19 10:03:49 PST 2009


On Mon, Jan 19, 2009 at 12:57 PM, Ellery Newcomer
<ellery-newcomer at utulsa.edu> wrote:
> IndexExpression:
>        PostfixExpression [ ArgumentList ]
>
>
> The only place I can think of ArgumentList containing more than one element
> is in some sort of overloaded operator case.

You're precisely right.

class Foo
{
    void opIndexAssign(int value, int a, int b)
    {
        Stdout.formatln("a = {}, b = {}, value = {}", a, b, value);
    }
}

auto f = new Foo();
f[3, 4] = 5; // prints "a = 3, b = 4, value = 5"


More information about the Digitalmars-d-learn mailing list