Kagamin Wrote: > Jason Spencer Wrote: > > > If I want to avoid the copy, am I relegated back > > to pointers? > or something like this
struct ReferenceArray!(ArrayType)
{
ArrayType* back;
this(byte[] data)
{
assert(data.length==ArrayType.sizeof);
back = cast(ArrayType*)data.ptr;
}
//will it be inlined?
auto opIndex(int column, int row)
{
return (*back)[row][column];
}
}
byte[] data = getData();
ReferenceArray!(float[100][100]) matrix = data;
writeln(matrix[1][2]);
