Standard C++ Library User Guide and Tutorial
v.insert(v.begin(), auto_ptr<string>(new string("Venice")));
// Everything is fine since auto_ptrs transfer ownership of
// their pointers when copied
// Now remove the first element
v.erase(v.begin());
// Success
// When auto_ptr(string("Venice")) is erased (and destroyed)
// string("Venice") is deleted
}
return 0;
}