[WIP] fix MSVC build in neighbors

Some parts of the new neighbors code doesn't build under MSVC.

If anybody knows a better way to do this, please help.