NA:

Any ideas welcome.

Is this good enough?

void main() {
    import std.algorithm: swap;

    int[][][][] a =
        [[[],
          [],
          [[0, 1], [0, 2]],
          [[0, 0], [0, 3]]
         ],
         [[],
          [],
          [[1, 1], [1, 2]],
          [[1, 0], [1, 3]]
         ]
        ];

    int[][][][] b =
        [[[[0, 1], [0, 2]],
          [[0, 0], [0, 3]],
          [],
          [],
         ],
         [[[1, 1], [1, 2]],
          [[1, 0], [1, 3]],
          [],
          []
         ]
        ];

    foreach (s1; a) {
        swap(s1[0], s1[2]);
        swap(s1[1], s1[3]);
    }
    assert(a == b);
}


Bye,
bearophile

Reply via email to