just today I stumbled across this short piece of code that confused me a little.
#include <iostream>
#include <iterator>
int main()
{
int array[] = {0,1,2,3,4,5,6,7,8,9};
auto start = std::begin(array);
while (start != std::end(array))
std::cout << *start++ << std::endl;
}
The thing that is confusing me here is that the 0 is the first output. I read a lot of posts regarding the order of the 2 operators and every single one said: "start" would be incremented first, THEN dereferenced. But std::begin() returns an iterator to the beginning of the array. With this being said, if I increment the pointer to the beginning of the array first before dereferencing it, shouldn't my first output be the 1? Thanks in advance!