Use const_iterator to resolve Visual Studio 2008 compile error

Patch from @patricksnape.

This particular compile error didn't occur in Stan 2.2 so it seems there was a change that introduced the problem. I'm not sure why VS 2008 is raising an error, but perhaps the C++ savants can guess.