I've mentioned this before, but I'm a bit iffy about using `RefCounted` in a non-100% explicit context (eg `Array`). This is because the GC is non-terminating, and placing a `Group` on the GC *will* result in a memory leak. Something as trivial as:

```D
auto groups = [ 1, 2, 2, 3, 3, 3, 4, 5, 5, 6, ].groupBy().array();
```
*Will* result in a memory leak.

Given you are using `SharedInput` as something shared, I don't think it is very problematic to just allocate on the GC and store a `SharedInput*`. It's not like `uni`'s small string optimization or anything.

Also, could you add this usecase to the unittests: I mean, eagerlly walk and store the groups, and then see if the groups themselves are still coherent.