Check if retain from vector was successful?

retain retains everything that passes the predicate; removing all but one Cat is correct. The predicate, however, counts deleted entries wrong; it's adding one whenever an entry is not deleted, which is the opposite of what it should do. Changing the check to if !b fixes this.

1 Like