奇怪的代码中断在 MSVC 中构建。这是什么意思?

bas*_*ibe 5 c++ rapidxml compiler-errors visual-studio-2010

我正在尝试将rapidxml 包含到我当前的项目中。但是,它不会构建。

Visual Studio 会抱怨这段代码 (rapidxml.hpp:419+451):

419: void *memory = allocate_aligned(sizeof(xml_attribute<Ch>));
420: xml_attribute<Ch> *attribute = new(memory) xml_attribute<Ch>;
Run Code Online (Sandbox Code Playgroud)

编译器会说

Rapidxml.hpp(420):错误 C2061:语法错误:标识符“内存”

我有点明白这会如何混淆编译器。它实际上也让我很困惑。什么(memory)的一部分new(memory) xml_attribute<Ch>做什么呢?

如果我删除那(memory)部分,它编译就好了。
此外,gcc 编译它就好了(memory)

编辑:
哦,我重载newDEBUG_NEW做一些内存调试。DEBUG_NEW不支持新放置。

Ada*_*upp 1

这称为“新展示位置”。它实例化 xml_attribute 的实例,memory而不是为其分配新内存。看:

http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.10

我不确定为什么 VC2010 的语法有问题。