C++11: convert verbose loops to range-based loops.