vector cast rather than copy in loop