I have been trying to run through the standard exceptions and catch them as an exercise.
I am having trouble with catching out_of_range with the following code in visual studio (windows), instead of my code catching the exception, instead I get a Microsoft Visual C++ Runtime libary popup, "debug assertion failed" .
Am I missing a project setting perhaps?
int main() {
try {
vector<int> myVector(10);
myVector[22] = 100;
}
catch (const std::out_of_range &exception)
{
std::cout << "exception caught: " << exception.what() << std::endl;
}
}