On Sunday, 6 September 2015 at 10:12:58 UTC, ParticlePeter wrote:
In the end all that I want is "just" to disable access to array.length through vector and alias this array.

struct Vec(T, size_t n = 3)
{
    T[n] data;

    alias data this;

    @disable @property size_t length() const;
}

void main()
{
    Vec!int v;
    v[0] = 1;           // ok
    assert(v[0] == 1);  // ok
    int n = v.length;   // error
}

- Kenji

Reply via email to