On Tuesday, 21 January 2020 at 04:44:43 UTC, Boris Carvajal wrote:
This seems to work:
...
struct RangeImpl(T) {
alias byKeyRetType =
typeof(byKey!(int[T])((int[T]).init));
byKeyRetType keyRange;
this(ref int[T] d) {
keyRange = d.byKey;
}
bool empty() {
return keyRange.empty;
}
...
}
RangeImpl!T opSlice() {
return RangeImpl!T(_dict);
}
}
void main()
{
...
if (h[].all!(nn => nn < 5)) {
writeln("less than 5");
}
Thank you very much! I have completely forgotten about typeof().
I see you also fixed my unnecessary (T) template parameter to
opSlice, which also caused a compilation error in addition to the
first mistake. I think this is because it "shadows" the original
T parameter from the struct itself, right?