Bring in VS2013 fixes.

Mostly missing <algorithm> include.

Change-Id: I6f72b690f445148d028ac07134abbcd4ff1d5df8
Merge topic 'vs2013_fixes' into next

96503d22 Bring in VS2013 fixes.