Line 12 creates an istream_iterator that’s capable of extracting (inputting) int values from the standard input object cin. Line 14 dereferences iterator inputInt to read the first integer from cin and assigns that integer to number1. The dereferencing operator * applied to iterator inputInt gets the value from the stream associated with inputInt; this is similar to dereferencing a pointer. Line 15 positions iterator inputInt to the next value in the input stream. Line 16 inputs the next integer from inputInt and assigns it to number2.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.