On Tuesday, 14 October 2014 at 12:51:29 UTC, Nordlöw wrote:


Could you please give me a code example? I'm not skilled enough in D to follow this description.

struct Range(T) {
  Array!S array;
  T opIndex(size_t i) {
     return cast(T)array[i];
  }
}

struct Array(T) {
  Range!(const(T)) opSlice() const {
     return Range!(const(T))(cast(Array!T)array, 0, length);
  }

  Range!(T) opSlice() const {
    return Range!(T)(cast(Array!T)array, 0, length);
  }
}



Reply via email to