On Friday, 10 January 2014 at 20:33:29 UTC, monarch_dodra wrote:
On Friday, 10 January 2014 at 20:23:32 UTC, John Colvin wrote:
On Friday, 10 January 2014 at 20:08:32 UTC, Atila Neves wrote:
I expected popFront at first to return the popped element as
well, and would use a function like that. You're not alone.
But... like you did, I'd just define my own convenience
function and UFCS keeps everything readable so no biggie. But
something in Phobos would be better, methinks. std.range.take
is similar, but not the same since it returns a range and not
an element. Also, it requires passing in the very common "1"
as an argument.
It's not ideal as full-speed performance depends on the Take
struct being optimised away, but there is always:
auto blah = range.takeOne.front;
What's that the point of writing that over:
auto blah = range.front;
?
oh... I thought the take functions advanced the range.