<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 11 January 2014 00:26, monarch_dodra <span dir="ltr"><<a href="mailto:monarchdodra@gmail.com" target="_blank">monarchdodra@gmail.com</a>></span> 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:13:37 UTC, marcpmichel 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:02:21 UTC, Manu wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I won't start another annoying thread.<br>
<br>
What's the go with popFront()... it returns nothing?<br>
I almost always want to pop and return the front element. I can't find a<br>
function to do that... have I missed something again?<br>
</blockquote></blockquote>
<br>
There isn't (at least, not that I know of). I would be trivial to implement, but because it would be implemented in terms of front/popFront, it would not be any faster.<br>
<br>
*However*, depending on the range type (non-transitive), popping might instantaneously invalidate the element you are operating on (think "byLine", that returns a "char[]", not a "string").<br>
</blockquote><div><br></div><div>Since you mentioned it here yesterday, I thought 'byLine' would be useful this morning... but I can't find it!</div><div>This is an embarrassing theme.</div><div><br></div><div>
Does it actually exist, and I am even further retarded... or did you just make that up?</div><div><br></div><div>File seems to have one, but that's no good for general text processing.</div><div>I can see std.string.splitLines, but that's not the same thing; it allocates in a case where I don't need to.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It seems you have to use both the .front property to access the element, and popFront() to advance to the next element.<br>
I can't understand why you need two methods; maybe there's a very good reason for that.<br>
</blockquote>
<br>
You *need* two methods for the very simple use case of reading without popping.<br>
<br>
As for returning the popped element when calling pop: It's an extra cost. C++ introduced back and pop_back (as well as pop/top) with those exact semantics for this reason. D also adds an issue of data integrity.<br>
</blockquote></div><br></div></div>