Switch a number of loops over to using C++11 style.