Smart slicing

Janice Caron caron800 at googlemail.com
Thu Mar 20 23:58:19 PDT 2008


On 20/03/2008, bearophile <bearophileHUGS at lycos.com> wrote:
>  A bare-bone semantic like that can be implemented in D like this

or like this:

    struct Slice(T)
    {
        T[] array;
        T opIndex(int i) {...}
        Slice opSlice(int i, int j) {...}
        Slice stride(int i, int j, int k) {...}
        /*etc*/
    }

That way, you can preserve the D syntax and at the same time allow
smart slicing.



More information about the Digitalmars-d mailing list