Simple casting?

Taylor R Hillegeist taylorh140 at gmail.com
Tue Nov 26 16:13:43 UTC 2019


On Tuesday, 26 November 2019 at 06:45:19 UTC, Alex wrote:
> On Tuesday, 26 November 2019 at 05:17:54 UTC, Taylor R 
> Hillegeist wrote:
>> [...]
>
> What exactly is the problem, as this works for me if I 
> understood your goal correctly:
>
> ´´´
> void main()
> {
>     import std.algorithm.comparison : equal;
>     import std.array;
>     import std;
>     // Grouping by particular attribute of each element:
>     uint[3][] data = [
>         [1, 1,0],
>         [1, 2,0],
>         [2, 2,0],
>         [2, 3,0]
>     ];
>
>     auto r1 = data.chunkBy!((a,b) => a[0] == b[0]);
> }
> ´´´
>
> If it is the type of the return value --> the return value of 
> chunkBy has a different one compared to the input. Instead, you 
> get an abstracted range whereas the input data serves as a 
> source.

I like auto and all. But I wanted the return of the respective 
type. I can't figure out how to get the type uint[3][][]; that is 
the type my function takes but I can't figure out how to get it 
converted.


More information about the Digitalmars-d-learn mailing list