
Timmo Stange wrote:
Such a combiner would violate the single pass traversal limitation of the input iterator concept. The cache solution allows dereferencing the same iterator multiple times to acquire the same value without calling the slot again, which already is a stronger guarantee than an input iterator usually provides. The combiner example in the docs makes use of it.
On a side note, I think this may have some funny implications. The iterator_facade cannot return an iterator for the post-increment operator, because dereferencing it would violate the same rule. So I guess if you traverse the slot range in the combiner with "i++", you will call all the slots without ever dereferencing the iterator, while traversal with "++i" will not call them. Or am I missing something here? Regards Timmo Stange