HP Integrity NonStop H-Series User Manual
Page 233
Advertising

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;
}
Advertising
This manual is related to the following products: