On 11/5/21 5:43 PM, Andrey Zherikov wrote:
In case others want to work, here are the modules that need to be imported:
import std.algorithm;
import std.range;
import std.stdio;
> struct A {}
> struct B
> {
> A[] ar = [A.init];
> size_t[] idx = [0];
I don't know why but those initial values are the reason for the
problem. It works without them.
>
> A*[] get()
> {
> return idx.map!((idx) => &ar[idx]).array; // Error: couldn't
> find field `ar` of type `A[]` in `MapResult([0LU], null)`
> }
> }
>
> auto foo()
> {
> B b;
> return b.get();
> }
>
> void main()
> {
> writeln(foo()); // This works
> pragma(msg, foo()); // This doesn't work
> }
Ali