I would like to use the std::vector without exceptions. In my section of code, I am using all new calls with the (std::nothrow) to prevent it to throw.
But in case of a vector, I do not know how to use it so it will never throw an error but rather fail the insert() or push_back() call.
Wrapping the push_back() call with a try/catch is not a solution, this shall work without using exception handling at all.
// create a vector
std::vector<int> *V;
// here I can prevent exceptions.
V = new (std::nothrow) std::vector<int>();
if(!V)
{handle_error();return;}
// Can I prevent this to throw anything and rather get an error result?
V->push_back(42);