Fighting compiler - experienced programmer but D novice
Jacob Carlborg via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jun 2 23:35:13 PDT 2014
On 03/06/14 05:57, Charles Parker wrote:
> Chris, that was it I needed to do both things. It then complained
> about trying to allocate the in_edges and out_edges arrays in the
> constructor which is how I thought dynamic arrays are allocated
> on the heap. I removed the 2 new statements, and both compile and
> execution of my initial test worked.
You don't really need to allocate the arrays. You can just declare them
and start using them:
int[] foo;
foo ~= 4; // append 4 to the array
Arrays in D are a implemented as a struct with a pointer to the data and
a field with the length of the array.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list