Covariance for []

davemo zeforeg at inboxbear.com
Thu Jan 19 13:20:08 UTC 2023


On Thursday, 19 January 2023 at 12:54:39 UTC, davemo wrote:
> Hello, I was wondering why the following code does not compile.
>
> ```d
> import std;
>
> [...]

It looks like the following change works fine.

```d
     Range!A as()
     {
         return wrap(_bs.map!((b) { return cast(A) b; }));
     }
```


More information about the Digitalmars-d-learn mailing list