simplify implementation of read_locations, using STL