On Monday, 11 November 2013 at 00:16:31 UTC, bearophile wrote:
Built-in D arrays are always dense (unless you consider the associative arrays). That page should name them "contiguous".

From the wiki article, "when all the dimensions of the array are known at compile-time, the array is automatically implemented as dense array".

My understanding is:
1) Every static array is contigous.
2) If all dimensions lengths can be "known at compile time" the array is contigous 3) If array is allocated using the method from wiki article the array is contigous

In all other cases it's not.
Now, i'd like to have a function to ask for any of this conditions to be met. Especially point 2) should be implemented in standard library instead of my custom code.

If you want to tell apart a regular dynamic array from the contiguous one, you have to look at the array structure, all dimensions but the last one need to be fixed-sized arrays.
So it's not contigous http://dpaste.dzfl.pl/7c5d2fa8 ?

Why do you need this information? So far I have not needed it.

There are two (not so important) reasons.
1. I'd like to use `1 memcpy(m*n)` instead of `m memcpy(n)`.
2. I'd like make a clean distinction in my code between contigous and non-contigous arrays. The goal is to use contigous arrays in every case when i don't need to resize inner arrays.

Reply via email to