common: optimize list_for_each()

In the C++ examples it is always ++it instead of it++ as the
prefered method. So change it accordingly.