store the comparator by value (unless there are good reasons not to)