<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1894.2">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 16.0px 'Inconsolata-dz for Powerline'}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 16.0px 'Inconsolata-dz for Powerline'; min-height: 21.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px 'Inconsolata-dz for Powerline'; color: #000080}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 18.0px; font: 16.0px 'Inconsolata-dz for Powerline'; min-height: 21.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 18.0px; font: 16.0px 'Inconsolata-dz for Powerline'}
p.p6 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px 'Inconsolata-dz for Powerline'; color: #000080; min-height: 21.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 18.0px; font: 16.0px 'Inconsolata-dz for Powerline'; color: #000080; min-height: 21.0px}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px 'Inconsolata-dz for Powerline'; min-height: 21.0px}
p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px 'Inconsolata-dz for Powerline'; color: #808080}
</style>
</head>
<body>
<p class="p1">On 2020-01-07 17:42:48 +0000, Adam D. Ruppe said:</p>
<p class="p2"><br></p>
<p class="p3">So [x][y] indexes an array of arrays.</p>
<p class="p4"><br></p>
<p class="p5">Yes, that's what I understand. And both can be dynamic, so that I can have a "flattering" layout where not all arrays have the same length.</p>
<p class="p4"><br></p>
<p class="p3"><span class="Apple-converted-space"> </span>[x,y] indexes a single array that has two dimensions.</p>
<p class="p4"><br></p>
<p class="p5">Does this fix the dimension sizes? So I can't add a "row" or "column" at runtime?</p>
<p class="p4"><br></p>
<p class="p5">What are the difference use-cases for these two? For example, I'm doing a grid widget but want to add/remove rows/columns. Can this only be done with a array-of-array? Is the memory continuous in the [x,y] case, whereas in the [x][y] this is not necessarily the case?</p>
<p class="p4"><br></p>
<p class="p3">This can be kinda confusing because we often think of</p>
<p class="p6"><br></p>
<p class="p3">int[4][4]</p>
<p class="p6"><br></p>
<p class="p3">as being a 2d array, but the D language actually technically sees that as an array of arrays. So it is indexed with [x][y].</p>
<p class="p4"><br></p>
<p class="p5">Yes, it's confusing as I don't understand the [x,y] case :-)</p>
<p class="p7"><br></p>
<p class="p3">There is no built in multi-dimensional array, it is only syntax provided for library types to implement with the opIndexAssign overloads.</p>
<p class="p4"><br></p>
<p class="p5">I don't get that sentence. Above you write "a single array that has two dimensions" which IMO is exactly a multi-dimensional array.</p>
<p class="p4"><br></p>
<p class="p3">So the operator there like += or -= or *= etc become opAssign, whereas plain = is just plain Assign.</p>
<p class="p4"><br></p>
<p class="p5">Got it. Thanks.</p>
<p class="p8"><br></p>
<p class="p9">--<span class="Apple-converted-space"> </span></p>
<p class="p9">Robert M. Münch</p>
<p class="p9">http://www.saphirion.com</p>
<p class="p9">smarter | better | faster</p>
</body>
</html>