使用 MinGW 4.6.2(使用 g++ -g -std=c++0x)编译以下内容,gdb 似乎不想抓住std::out_of_range
if I try catch throw
。如果我throw
手动它会很好,我做错了什么吗?
#include <stdexcept>
#include <vector>
int main()
{
std::vector<char> vec(10);
try {
vec.at(10); // this won't be caught by gdb
// throw std::out_of_range(""); // this will
}
catch (std::out_of_range const& e) {
}
}