Assign to Array Column

Siarhei Siamashka siarhei.siamashka at
Wed Feb 1 13:14:47 UTC 2023

On Tuesday, 31 January 2023 at 01:04:41 UTC, Paul wrote:
> Greetings,
> for an array byte[3][3] myArr, I can code myArr[0] = 5 and have:
> 5,5,5
> 0,0,0
> 0,0,0
> Can I perform a similar assignment to the column?  This, 
> myArr[][0] = 5, doesn't work.

This works fine for small arrays, but for large arrays such 
access pattern is cache unfriendly. It's usually best to redesign 
the code to avoid assignments to columns if possible (for 
example, by working with a transposed array). The language is not 
providing a convenient shortcut for something that is usually 
undesirable and expensive. And I think that this is actually 

More information about the Digitalmars-d-learn mailing list