In general, if you want to do something once per element which involves side
effects, I would advise using foreach rather than trying to put it into a
range.

using foreach breaks UFCS chains, and also ElementType != ForeachType
 
But if you insist on doing so, the side effect should go in popFront,
not front, or the side effects will often be happening more than once per
element.

This won't work if side effect should occur _before_ element is popped. And this is very awkward to use with map/reduce/filter, as it forces one to write explicitly a range wrapper, defeating purpose of reusing phobos components. Having to write a custom range (with pop/front/popBack etc) just to support lambdas with side effects is a pain. 

I'd like to propose a generic solution for that, see the email I just sent:

"std.range.cacheFront proposal&working code: wraps a range to enforce front is called only once"