digitalmars.D.learn - correct way to set a dynamic 2d array?
- clayasaurus (6/6) May 30 2005 is this the correct way to set a dynamic 2D array?
- Derek Parnell (12/22) May 30 2005 Currently, yes. Though it could also be written as ...
- Hasan Aljudy (3/28) May 30 2005 can't you just say this?
- Derek Parnell (7/33) May 30 2005 No. You get this message ...
- Jarrett Billingsley (4/8) May 31 2005 Isn't this something that would be possible with array vectorization?
- Stewart Gordon (8/14) Jun 02 2005 But it would create confusion..
is this the correct way to set a dynamic 2D array? int[][] dynamic; dynamic.length = width; for (int i = 0; i < dynamic.length; i++) dynamic[i].length = height; Just seems a bit weird.
May 30 2005
On Tue, 31 May 2005 03:56:00 +0000, clayasaurus wrote:is this the correct way to set a dynamic 2D array? int[][] dynamic; dynamic.length = width; for (int i = 0; i < dynamic.length; i++) dynamic[i].length = height; Just seems a bit weird.Currently, yes. Though it could also be written as ... int[][] dynamic; dynamic.length = width; foreach (inout int[] x; dynamic) x.length = height; -- Derek Melbourne, Australia 31/05/2005 2:33:02 PM
May 30 2005
Derek Parnell wrote:On Tue, 31 May 2005 03:56:00 +0000, clayasaurus wrote:can't you just say this? dynamic[].length = height;is this the correct way to set a dynamic 2D array? int[][] dynamic; dynamic.length = width; for (int i = 0; i < dynamic.length; i++) dynamic[i].length = height; Just seems a bit weird.Currently, yes. Though it could also be written as ... int[][] dynamic; dynamic.length = width; foreach (inout int[] x; dynamic) x.length = height;
May 30 2005
On Tue, 31 May 2005 00:31:47 -0600, Hasan Aljudy wrote:Derek Parnell wrote:No. You get this message ... slice expression dynamic[] is not a modifiable lvalue -- Derek Melbourne, Australia 31/05/2005 4:46:02 PMOn Tue, 31 May 2005 03:56:00 +0000, clayasaurus wrote:can't you just say this? dynamic[].length = height;is this the correct way to set a dynamic 2D array? int[][] dynamic; dynamic.length = width; for (int i = 0; i < dynamic.length; i++) dynamic[i].length = height; Just seems a bit weird.Currently, yes. Though it could also be written as ... int[][] dynamic; dynamic.length = width; foreach (inout int[] x; dynamic) x.length = height;
May 30 2005
"Derek Parnell" <derek psych.ward> wrote in message news:k3gx4tkutm62$.wl0ydvkulqru.dlg 40tude.net...Isn't this something that would be possible with array vectorization? I'd really love this syntax..can't you just say this? dynamic[].length = height;No. You get this message ... slice expression dynamic[] is not a modifiable lvalue
May 31 2005
Jarrett Billingsley wrote:"Derek Parnell" <derek psych.ward> wrote in message news:k3gx4tkutm62$.wl0ydvkulqru.dlg 40tude.net...<snip>can't you just say this? dynamic[].length = height;I'd really love this syntax..But it would create confusion.. http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/1942 Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jun 02 2005