Before anybody asks: The cast is written that way if pred takes by ref.