On Monday, 8 June 2020 at 06:52:36 UTC, mw wrote:
On Monday, 8 June 2020 at 06:42:44 UTC, Simen Kjærås wrote:
Arrays (technically, slices) in D are essentially this struct:
struct Array(T) {
T* ptr;
size_t length;
// operator overloads
}
So when you have int[][], each element of t
On Monday, 8 June 2020 at 06:13:36 UTC, mw wrote:
what I really want in (a) is append `ref arr` and output [[3],
[3], [3]], i.e. the real `arr` be appended instead of its copy.
I tried to change arrs' decl to:
(ref (int[]))[] arrs; // the intended semantics I want
1) I'm wondering how
On Monday, 8 June 2020 at 06:42:44 UTC, Simen Kjærås wrote:
Arrays (technically, slices) in D are essentially this struct:
struct Array(T) {
T* ptr;
size_t length;
// operator overloads
}
So when you have int[][], each element of the outer array is an
Array!int. These, as simple s
On Monday, 8 June 2020 at 06:13:36 UTC, mw wrote:
Hi,
I have this program:
import std.stdio;
void f(ref int[] arr) {
arr ~= 3;
}
void main() {
int[][] arrs;
int[] arr;
foreach (i; 0 .. 3) {
arr
Hi,
I have this program:
import std.stdio;
void f(ref int[] arr) {
arr ~= 3;
}
void main() {
int[][] arrs;
int[] arr;
foreach (i; 0 .. 3) {
arr = new int[0];
arrs ~= arr; //(a) [