我目前正在阅读有关 ostream 迭代器(迭代器适配器)的信息,作者给出了以下示例:
/* Declare an ostream_iterator that writes ints to cout. */
ostream_iterator<int> myItr(cout, " ");
/* Write values to the iterator. These values will be printed to cout. */
*myItr = 137; // Prints 137 to cout
++myItr;
*myItr = 42; // Prints 42 to cout
++myItr
我很好奇为什么该示例在为其赋值后会执行 ++myItr ?