On Thursday, 3 October 2019 at 04:32:52 UTC, Brett wrote:
Ok, fine!
auto r =
Now r is a reference, great!
No, r is a pointer, not a reference. D does not have reference
variables.
But now the semantics of using the array completely change and
errors abound!
Probably because you're
On Thursday, 3 October 2019 at 04:32:52 UTC, Brett wrote:
struct Y { double q; }
struct X { Y[] a; }
X x;
auto r = x.a;
r is not a reference?!?!
Arrays are (ptr,length) pairs. r is a copy of them:
#! /usr/bin/env rdmd
import std.stdio;
struct X { int[] a; }
void main() {
struct Y { double q; }
struct X { Y[] a; }
X x;
auto r = x.a;
r is not a reference?!?!
When updating x.a, r is not updated ;/ [I'm not sure if it just
creates a slice or what]
Ok, fine!
auto r =
Now r is a reference, great!.
But now the semantics of using the array completely change