std::bad_alloc& e 相当于python的execpt Exption as e
#include <iostream> using namespace std; void abc(){ throw "adfadf"; } int main(int argc, char const *argv []){ try { abc(); }catch(bad_alloc& e){ printf("%s\n", e.what()); } return 0; }
std::bad_alloc& e 相当于python的execpt Exption as e
#include <iostream> using namespace std; void abc(){ throw "adfadf"; } int main(int argc, char const *argv []){ try { abc(); }catch(bad_alloc& e){ printf("%s\n", e.what()); } return 0; }