I wrote code that throws an exception if the given user input is invalid, so I put it in a try / catch block, but it still threw an exception. The code itself is quite long, so here is a simplified version of the code that also encounters an exception. The exception itself is clear, the position “3” does not exist, so naturally it throws an exception, but inside the try / catch block it must be caught, but it is not.
int main() {
try
{
vector<string> test = vector<string>{ "a","b","c" };
string value = test[3];
}
catch (...)
{
}
}
Running this code throws the following exception, regardless of whether it is in a try / catch block.

I also tried to throw an exception ( const out_of_range&e), but that didn't help either. It just caused the same exception.
int main() {
try
{
vector<string> test = vector<string>{ "a","b","c" };
string value = test[3];
}
catch (const out_of_range&e)
{
}
}
Visual Studio, IDE ?