After std::vector::resize() throws a std::bad_alloc exception, is the original data still valid and accessible in the std::vector object?
Does the answer hold for other allocators, e.g. if boost::interprocess::allocator is used as the allocator, and boost::interprocess::bad_alloc is thrown?
std::vector::resize is exception safe.
If an exception is thrown, this function has no effect (strong exception guarantee).
Link to the exception specification. The specification doesn't mention any particular requirement on the allocator and must hold regardless of the allocator you provide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With