Fix build failure on FreeBSD/clang by using auto iterator type