Extended functionality for C++ loops