Convert several "for" loops to use the newer C++11 range-based style.
Much more readable!
Whitespace-only changes to match indentation and brace style used elsewhere.
Add many const qualifiers, especially to container element types.

For types which are non-const pointers to const data, use "const Foo
*" instead of "Foo const *".  These are actually equivalent, but it's
far more common for C/C++ programmers to put the qualifiers before the
type in situations like this.  Putting it after would definitely make
some folks tilt their head sideways, and possibly even misinterpret
what part the "const" applies to.