when should ranges be static
Inkrementator
invalid at invalid.org
Sat Feb 15 15:20:07 UTC 2025
On Saturday, 15 February 2025 at 11:47:58 UTC, Inkrementator
wrote:
> Wrapping foo in another delegate seems to at least compile.
Same as splitting out the struct. I don't understand why a struct
outside of a function gets treated differently than a static
struct.
```
auto split(alias F,R)(R r){
return splitter!(F,R)(r);
}
private struct splitter(alias F, R){
R r;
auto front()=>r.takeuntil(r.findnext!F);
void popFront(){r=r.findnext!F;}
bool empty()=>r.empty;
}
```
More information about the Digitalmars-d-learn
mailing list