Remove raw pointers in QueryWhere
Use ranged for