<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 11 January 2014 01:20, John Colvin <span dir="ltr"><<a href="mailto:john.loughran.colvin@gmail.com" target="_blank">john.loughran.colvin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Friday, 10 January 2014 at 15:19:39 UTC, John Colvin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Friday, 10 January 2014 at 15:05:18 UTC, monarch_dodra wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Friday, 10 January 2014 at 14:31:31 UTC, John Colvin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
or if you want something short and simple, define a free function:<br>
auto popFrontRet(R)(ref R range)<br>
  if(isInputRange!R)<br>
{<br>
  range.popFront();<br>
  assert(!range.empty);<br>
  return range.front;<br>
}<br>
</blockquote>
<br>
*Unless* I'm mistaken, he was asking for something that returns the *popped* element?<br>
<br>
Re-reading the question, it does kind of sound a bit ambiguous now.<br>
</blockquote>
<br>
Woops, of course:<br>
<br>
auto popFrontRet(R)(ref R range)<br>
    if(isInputRange!R)<br>
{<br>
    auto tmp = range.front;<br>
    range.popFront();<br>
}<br>
<br>
<br>
That also invalidates my second point to do with emptiness.<br>
</blockquote>
<br></div></div>
ugh, today is not my day:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
auto popFrontRet(R)(ref R range)<br>
    if(isInputRange!R)<br>
{<br>
    auto tmp = range.front;<br>
    range.popFront();<br></div>
    return tmp;<br>
}<br>
</blockquote>
</blockquote></div><br></div><div class="gmail_extra">Yes, this is what I did. It should be added to phobos, but I figured there's a reason it's not there...</div><div class="gmail_extra">My point was, I want this more often than I want either of those other primitives. I'm surprised it doesn't exist, and suspected I was just being blind again.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">I also wrote popFrontRetN to capture more than one element from the start.</div></div>