The rfind challenge

FG home at fgda.pl
Tue Jan 15 11:44:53 PST 2013


On 2013-01-15 19:00, Andrei Alexandrescu wrote:
> That's too many. Simpler approaches?


Let me give an outside perspective of someone that doesn't work with D all day.
For forward ranges the original method is fine, but for bidirectional r and e I 
would expect the following code to somehow just work, but it doesn't:

     auto rfind(R1 r, R2 e) {
         return retro(findSplitAfter(retro(r), retro(e))[0]);
     }

Other than the tiny detail of this not working, existing stuff like findSplit, 
findSplitBefore and findSplitAfter would be enough to define their r* versions.




More information about the Digitalmars-d mailing list