containers: Fixed API and implementation of erase() methods.