Can you simplify nested Indexed types?
Sergei Nosov
sergei.nosov at gmail.com
Tue Dec 27 15:09:11 UTC 2022
Consider, I have the following code:
```
auto a = [3, 6, 2, 1, 5, 4, 0];
auto indicies = iota(3);
auto ai = indexed(a, indicies);
ai = indexed(ai, iota(2));
writeln(ai);
```
Basically, my idea is to apply `indexed` to an array several
times and have all the intermediaries saved in the same variable.
The provided code doesn't compile with an error:
```
Error: cannot implicitly convert expression `indexed(ai,
iota(2))` of type `Indexed!(Indexed!(int[], Result), Result)` to
`Indexed!(int[], Result)`
```
I wonder, if there's a way to "collapse" or "simplify" the
`Indexed!(Indexed!(int[], Result), Result)` type to just
`Indexed!(int[], Result)` ?
More information about the Digitalmars-d-learn
mailing list