How to return a reference to structs?

kdevel kdevel at vogtner.de
Fri Nov 5 18:44:16 UTC 2021


On Thursday, 4 November 2021 at 11:26:30 UTC, Andrey Zherikov 
wrote:
> I have the following code example:

[...]

> A[5] a;
> ulong[] idx = [1,3,4];

[...]

>     return idx.map!(_ => a[_]);

How can one make the type of idx's elements portable (compile 
with -m32 to see what the problem is)? This seems to be an 
surprisingly nontrivial issue at least in C [1].

[1] 
<https://stackoverflow.com/questions/3174850/what-is-the-correct-type-for-array-indexes-in-c>


More information about the Digitalmars-d-learn mailing list