Sign in to follow this  

C++ vectors exception handling

This topic is 4343 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, how would I handle my C++ vector exceptions? What exception is thrown when there isn't enough memory to add another element? Thanks for any help given.

Share this post


Link to post
Share on other sites
Quote:
Original post by Cacks
Hi guys,

how would I handle my C++ vector exceptions? What exception is thrown when there isn't enough memory to add another element?

Thanks for any help given.


what would you do when you catch such an exception? out of memory is a serious problem and there usually isnt much you can do about it

Share this post


Link to post
Share on other sites
std::vector with throw std::bad_alloc if there is an out of memory or memory corruption exception. Well, technically thats usually a function of the underlying allocator, but the default allocator should throw std::bad_alloc

Share this post


Link to post
Share on other sites

This topic is 4343 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this