<br><br><div class="gmail_quote">On Thu, Dec 31, 2009 at 01:11, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org">SeeWebsiteForEmail@erdani.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Kevin Bealer wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
It is becoming, however, increasingly clear that there are algorithms that could and should manipulate ranges by reference. They might take and return values, but it's just too messy to do so. (Cue music for the "improve built-in tuples choir.)<br>
<br></blockquote>
Let me suggest one more function I've found very useful:<br>
<br>
bool readUntil(R1, R2, R3)(ref R1 input, R2 delim, ref R3 result)<br>
{<br>
// Like findSkip, but returning intervening text.<br>
}<br>
</blockquote>
<br></div>
You read my mind. I was thinking of something with "copy" in the name.<br><font color="#888888">
<br></font></blockquote><div><br>I find popFrontUntil / popFrontWhile to be quite useful myself. Heck, I even needed an 'exhaust' function once, that just takes a range (mostly, the rest of a range inside an algorithm) and makes it empty. When writing these by-ref funs, I take care to indicate quite clearly in the docs that they modify the input range, because it's not a common pattern in std.algorithm.<br>
<br>I like Michel's suggestion to use consume as a prefix. If Phobos goes for a nested structure, you could put this consuming algorithms in a special module for them. std.algorith.consume or somesuch.<br><br> Philippe<br>
<br></div></div>