After deleting an object, executing the method of the object will not report an error, but return an indeterminate value.
/*After testing the delete MyVector object, execute the is_eof() function to see if it has ended*/ #include "vector.h" using uint32 = unsigned int; int main(){ MyVector<uint32> * mv = new MyVector<uint32> (); mv->start_write(); mv->push_back(1); mv->push_back(2); mv->start_read(); while(!mv->is_eof()){ std::cout << mv->get() << " "; mv->next_remove(); } delete mv; if( mv->is_eof() )std::cout << " is_eof() is true.\n"; else std::cout << " is_eof() is false.\n"; return 0; }