jjzjj

c++ - 无法在 MinGW 中捕获 bad_alloc

我正在为家庭作业编写一个程序,我需要分配许多对象来检查位置和性能等方面的事情。我似乎无法捕捉到new抛出的异常#include"List.h"#include#includeintmain(intargc,char**argv){coutnext=ptrList2;ptrList2->previous=ptrList;ptrList=ptrList2;}}catch(bad_allocconst&e){cout结果:ThisapplicationhasrequestedtheRuntimetoterminateitinanunusualway.Pleasecontacttheappli