Should this work?

Atila Neves atila.neves at gmail.com
Fri Jan 10 12:08:31 PST 2014


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.

Atila

> This is what I've done. I'm just surprised that such an obvious 
> function
> doesn't exist, and suspect I was just retarded at phobos again.
> Having a function that does this is kinda important to simplify 
> lots of
> expressions that otherwise need to be broken out across a bunch 
> of lines.
>
> Does nobody see this coming up in their code? I have it 
> basically every
> time I use ranges, and as usual, surprised others don't feel 
> the same way.



More information about the Digitalmars-d mailing list