+ 1
What is example of input iterator
We know that there are five types of iterators Input , output , forward , bi directional , random access I am aware that iterator on vector will result into random access iterator. Forward list will have forward iterator and list will have bi directional iterator... What container will provide input and output iterator? I just want to check on code that input iterator don't allow me to update value nd vice versa for output iterator.
3 Respostas
+ 5
As far as I know, there is no container that exposes an input or output iterator type. I know of two such iterators each in the standard library, which would be:
std::istream_iterator
std::istreambuf_iterator
std::ostream_iterator
std::ostreambuf_iterator
These are designed to read from or write to streams, where the "streambuf" version is specifically for characters, while the "stream" version is templated for any object to be read or written. You can have a look here:
https://en.cppreference.com/w/cpp/iterator/istream_iterator
https://en.cppreference.com/w/cpp/iterator/ostream_iterator
By the way, as of C++17, there are six iterator categories (continuous iterators).
+ 2
Ketan Lalcheta I did a quick reference and here are two references to input-iterator. Hope this helps.
https://www.javatpoint.com/cpp-input-iterator
http://www.cplusplus.com/reference/iterator/InputIterator/
+ 1
Thank you Shadow