MB-37096: Debug CRT: Fix Topkeys::doStatsInner invalid iterator
MB-37096: Debug CRT: Fix Topkeys::doStatsInner invalid iterator

Under Windows Debug CRT, StatsTest.TestTopkeys fails as it exposes some
undefined behaviour in TopKeys::doStatsInner - we advance an iterator
past the end of a container:

   vector(122) : Assertion failed: cannot seek vector iterator after end

This seems benign in Release builds (likely beause we just compare
pointers and it all works correctly), however this is tehnically a valid
warning.

Fix by just manually counting how many keys have been found, avoiding
the iterator arithmetic.

Change-Id: I464989dacd09d025f439daee1deec18290f19225
Reviewed-on: http://review.couchbase.org/121865
Well-Formed: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Jim Walker <1cd02e31b43620d7c664e038ca42a060d61727b9@couchbase.com>

daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine