On Tuesday, 30 June 2015 at 22:04:24 UTC, Justin Whear wrote:
alias IntList = int[10];
IntList[3] myIntLists;
int[10][3] myOtherIntLists; // same type as above
<<<
I understand the rationale, but some issues:
1. The rationale implicitly takes treats an n-dim array as a
(n-1)-dim array x (1)
On Tue, 30 Jun 2015 21:02:37 +, DLearner wrote:
> Out of curiosity, why can't D define a 2-dim array by something like:
> int(2,1) foo;
>
> which defines two elements referred to as:
> foo(0,0) and foo(1,0)?
Work is being done on multidimensional slicing, see this thread:
http://forum.dlang.o
On Tuesday, 30 June 2015 at 21:02:39 UTC, DLearner wrote:
On Tuesday, 30 June 2015 at 20:33:31 UTC, jmh530 wrote:
On Tuesday, 30 June 2015 at 20:17:12 UTC, Justin Whear wrote:
[...]
I think this is a good explanation.
Looking through
http://dlang.org/arrays.html
I see that the multidimension
On Tuesday, 30 June 2015 at 20:17:12 UTC, Justin Whear wrote:
No. The order of braces when indexing is the opposite of the
order when
declaring.
The declaration
int [1][2] foo;
reads innermost to outermost, "((int [1] ) [2])"
When indexing foo, you index from outermost to innermost, so
foo[
Oh, seems I should learn to refresh the page :)
Suppose:
'int [1][2] foo;'
Probably I misunderstand, but TDPL seems to say that foo has two
elements:
foo[0][0] and foo[1][0]
as opposed to two elements:
foo[0][0] and foo[0][1]
Is this correct?
I am pretty surprised, as the following code gives errors.
void main(){
int [1][2] foo;
foo[0][0] = 1;
foo[0][1] = 2;
foo[1][0] = 3;
foo[1][1] = 4;
}
Those errors are:
app.d(5): Error: array index 1 is out of bounds foo[0][0 .. 1]
app.d(7): Error: array index 1 is out of bound
On Tuesday, 30 June 2015 at 20:33:31 UTC, jmh530 wrote:
On Tuesday, 30 June 2015 at 20:17:12 UTC, Justin Whear wrote:
[...]
I think this is a good explanation.
Looking through
http://dlang.org/arrays.html
I see that the multidimensional array indexing is not
particularly focused on (could be
On Tue, 30 Jun 2015 20:09:50 +, DLearner wrote:
> Suppose:
> 'int [1][2] foo;'
>
> Probably I misunderstand, but TDPL seems to say that foo has two
> elements:
> foo[0][0] and foo[1][0]
>
> as opposed to two elements:
> foo[0][0] and foo[0][1]
>
> Is this correct?
No. The order of braces