On 1/15/13 1:31 AM, H. S. Teoh wrote:
Hmm. What about introducing a new primitive takeUntil, that returns the initial segment of the range until a given predicate becomes true? Then you could implement rfind thus:auto rfind(alias pred, R)(R range) if (isBidirectionalRange!R) { return range.retro() .takeUntil!pred() .retro(); }
That works, but returns a different type. Ideally rfind would return the same type as the initial range, R.
Andrei