How to call a templated overload of opIndex

Marc mailnawman at gmail.com
Fri Aug 15 21:45:09 UTC 2025


On Friday, 15 August 2025 at 21:09:50 UTC, Ali Çehreli wrote:
> >
> > Any help would be really appreciated.
>
> This design doesn't seem useful. How about something like the 
> following:
>
> import std.conv : to;
>
>     x[i, j].to!double;
>     y[i, j].to!float;
>
> Ali

Thanks a lot for your reply. It should be a bug to call it with 
double when the data is float and vice versa. I managed to make 
it work with a variant / sumtype. Now i can do the following

```d
auto df = new DataFrame!Ts(...)
auto value = df[0, 0];
//or
float value = df[0,0].get!float;
```


More information about the Digitalmars-d-learn mailing list