On Tuesday, 26 November 2019 at 23:29:12 UTC, Ali Çehreli wrote:
On 11/26/19 2:08 PM, Taylor R Hillegeist wrote:> On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote:
>>     int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array;
>
>
> how did you know to do that?
std.array.array pulls all elemenst of a range and places them inside an array. That is eager but sometimes necessary work. For example, std.algorithm.sort cannot sort just any range because it needs the elements to be layed out as array elements:

  someAlgorithmRange.sort;      <-- Does not work
  someAlgorithmRange.array.sort <-- Works

Ali

I suppose I'm asking here how did he know to use:
.map!array.array

I in my mind I thought that
.array
would have been enough, it seems like it when looking at the original error:

GetAllTriplesExtractFileIrqSplit.d(83):

Error: cannot implicitly convert expression `chunkBy(irqSortedSet)` of type

`ChunkByImpl!(__lambda4, ProbePoint[3][])` <<Its almost to the final form
to
`ProbePoint[3][][]`

does this have to do with the collection depth?




Reply via email to