#include #include struct Doctor { ~Doctor() { throw 99; } }; int main(int argc, char**argv) { std::vector docs; Doctor dolittle; docs.push_back(dolittle); std::cout << "Try to clear a vector with " << docs.size() << " items" << std::endl; try { docs.clear(); } catch(int& e) { std::cout << "caught exception: " << e << std::endl; } // it still thinks I have 1 item in the vector, this is bad std::cout << "Size of vector after clear is " << docs.size() << std::endl; return 0; }