Learn how an output iterator may write a value only once and then increment. It writes only, will not read, and will not decrement.
- [Instructor] An output iterator is the compliment…of the input iterator.…It may be used to write a value once and then increment.…Here I have a working copy of output-iterator.cpp…from chapter three of the exercise files.…The output iterator like the input iterator…is defined in the iterator header separately…from iostream even though it's normally used…with iostream and just like the input iterator,…the ostream iterator, the output iterator…is defined separately from cout,…because of the unique nature of cout and cin.…
So the output iterator is constructed here…with a separator and so that space will be used…to separate the output values.…And here we simply list some integer values…and we increment the output iterator…and assign the values to the de-referenced output iterator…and send endl and when I build and run,…you see three simple.…It prints the three values on the console.…And the delimiter is inserted after every value.…
So the iterator is used just like a pointer,…but only for output.…Assigned values are sent to the output stream…
- Template fundamentals
- STL containers
- Accessing iterators
- Output, forward, and bidirectional iterators
- The transform function
- Transforming strings and types
- Arithmetic, relational, and logical functions
- STL algorithms
Skill Level Intermediate
2. STL Containers
3. STL Iterators
5. STL Functions
6. STL Algorithm
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.