chapter 11 exercise 11-6: add erase and clear member function to Vec