bad_alloc标识符无法识别?

acw*_*421 1 c++ syntax compiler-errors visual-studio-2010 bad-alloc

我收到编译器错误:

错误C2061:语法错误:标识符'bad_alloc'

我以前在其他项目中使用过以下代码块,在try块中有不同的内存分配,没有问题.我希望有人可以向我解释为什么bad_alloc不被VS10识别,尽管它没有在其他程序中引起同样的问题?可能性是我错过了一些轻微的语法问题,但我花了好几个小时试图解决它,此时我觉得我可能对错误视而不见.谢谢您的帮助!

try
{
    node* tbr = new node();
    return tbr;
} // End try allocation

catch(bad_alloc)
{
     throw OutOfMemoryException();
} // End catch(bad_alloc)
Run Code Online (Sandbox Code Playgroud)

Arj*_*jen 6

bad_alloc在标题new中定义.

#include <new>
Run Code Online (Sandbox Code Playgroud)

在命名空间std.

using namespace std
Run Code Online (Sandbox Code Playgroud)