On Wednesday, 7 October 2015 at 14:59:28 UTC, Trass3r wrote:
On Tuesday, 6 October 2015 at 22:39:01 UTC, Ulrich Küttler
wrote:
Yes, this is an explanation. Thanks. So the argument being C++
customs. Now that you mention it, this seems to be the
argument in Eric's D4128 paper, too.
I was hoping for a somewhat deeper reasoning. Out of
curiously, I am still trying to grasp all the implications.
Ranges are hard.
Another one is "odd number of iterators algorithms"
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4128.html#appendix-3-d-ranges-and-algorithmic-complexity
D’s choice of algorithmic basis operations is inherently less
efficient than C++’s.
Hmm... conceptually a bidirectional range should be able to
iterate back and forth:
void is_word_boundary(Bidi r)
{
bool is_word_prev = r.re.empty ? false : isword(r.re.back);
bool is_word_this = r.empty ? false : isword(r.front);
return is_word_prev != is_word_this;
}
auto i = myrange;
for(; !i.empty; i.popFront())
if( is_word_boundary(i) )
break;