Removed a c++11 auto for loop to support VS2012 compiling.