enumerated iteration to struct

Fra Mecca me at francescomecca.eu
Wed Feb 7 01:10:34 UTC 2018


I don't know if this post belongs to the learn section, but I'll 
try anyway.

I am using the std.path.pathSplitter function that returns a 
PathSplitter function exposing ranges primitive.

I have some question that could be generalized to other structs 
that expose range primitives.

1. Why can't I write foreach(i, el; 
pathSplitter("foor/bar").enumerate)  ?
2. Supposing I want to fix this problem, what do I add to the 
struct? opApply?
3. Why doesn't ranges infer the iteration method at compile time 
so that I don't need to write enumerate?


More information about the Digitalmars-d-learn mailing list