October 2004
Intermediate to advanced
240 pages
6h 22m
English
Don’t use expired medicines: Both invalid objects and historical but unsafe functions wreak havoc on your program’s health.
There are three major kinds of invalid objects:
• Destroyed objects: Typical examples are automatic objects that have gone out of scope and deleted heap-based objects. After you call an object’s destructor, its lifetime is over and it is undefined and generally unsafe to do anything with it.
• Semantically invalidated objects: Typical examples include dangling pointers to deleted objects (e.g., a pointer p after a delete p;) and invalidated iterators (e.g., a vector<T>::iterator i after an insertion at the beginning of the container the iterator ...
Read now
Unlock full access