On Friday, November 09, 2012 14:52:20 deadalnix wrote: > So my question is, how this duplication can be avoided ? If it can, > .peekFront is definitively the way to go. But if it can't, this seems > like a really problematic point.
In most cases, it still won't be a problem. How much in the way of code is generally in front? Almost none. It's popFront which generally has the complicated logic. And if you do end up with a more abnormal range which requires a bunch of work in front, depending on what it does, it can just pass the result of front or peekFront to another function which does the work, or worst case, it can mixin the code. Mostly though, I wouldn't expect much code duplication to actually be required. - Jonathan M Davis