Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between a Boost Single Pass Iterator and a Forward Traversal Iterator?

In the New Iterator Concepts standard proposal, I am not able to decipher any useful difference between a Single Pass Iterator and a Forward Traversal Iterator.

Does the "Assertion/Note" for the "++r" row in the Forward Traversal table imply that Forward Traversal Iterators are copyable, whereas Single Pass Iterators are not?

Additionally, why does the additional ability to default-construct make an iterator model Forward Traversal? What's the rationale?

like image 495
Mukul M. Avatar asked Feb 23 '12 13:02

Mukul M.


1 Answers

The idea of the Single Pass Iterator is that it has less requirements than a Forward Traversal iterator. That makes it possible to create one for some cases where multi pass just isn't possible.

Think console input. Even if you could make a copy of the iterator, that wouldn't help you retrieve old keyboard input.

like image 110
Bo Persson Avatar answered Sep 28 '22 05:09

Bo Persson