Simplifiy code using return value of erase().