Size: type == size_t;
Real: type == double;
Mat: type = {
Elem: @struct type = {
entry: Real;
colind: Size;
}
data: ::std::valarray<::std::valarray<Elem>>;
operator[]: (inout this, row: Size, col: Size) -> forward Real = {
(inout datarow := data[row]) {
for datarow do(inout d)
16: if (d.colind == col) { return d.entry; }
s := datarow.size();
ndatarow := ::std::valarray<Elem>(s + 1);
i: Size = 0;
while i < s next i++ {
ndatarow[i] = datarow[i];
}
ndatarow[s] = Elem(0.0, col);
datarow = ndatarow;
25: return datarow[s].entry;
}
}
}
results in two errors:
poisson.cpp2(16,32): error: a 'forward' return type cannot return a local variable
poisson.cpp2(25,7): error: a 'forward' return type cannot return a local variable
This code transpiled without problems with earlier cpp2 versions (some weeks ago).
Transpiling
results in two errors:
This code transpiled without problems with earlier cpp2 versions (some weeks ago).