Simple casting?
Taylor R Hillegeist
taylorh140 at gmail.com
Tue Nov 26 05:17:54 UTC 2019
On Tuesday, 26 November 2019 at 05:05:48 UTC, Taylor R Hillegeist
wrote:
> I'm attempting to do a segment group.
>
> details:
> alias ProbePoint[3]=triple;
> triple[] irqSortedSet = UniqueTriples.keys
> .sort!("a[1].irqid < b[1].irqid",SwapStrategy.stable)
> .array;
> 83:triple[][] irqSortedSets = irqSortedSet.chunkBy!((a,b) =>
> a[1].irqid == b[1].irqid);
>
>
> GetAllTriplesExtractFileIrqSplit.d(83): Error: cannot
> implicitly convert expression `chunkBy(irqSortedSet)` of type
> `ChunkByImpl!(__lambda4, ProbePoint[3][])` to
> `ProbePoint[3][][]`
>
> I have something that looks like a triple[][] but I can't seem
> to get that type out.
> when I add .array it converts to a Group which doesn't make
> sense to me because I'm not using a unary comparison. Any
> thought?
a simpler example:
import std.algorithm.comparison : equal;
import std.array;
// Grouping by particular attribute of each element:
uint[3][] data = [
[1, 1,0],
[1, 2,0],
[2, 2,0],
[2, 3,0]
];
uint[3][][] r1 = data.chunkBy!((a,b) => a[0] == b[0]);
fails in the same way.
More information about the Digitalmars-d-learn
mailing list