我有重载运算符 new
的代码。下面的代码在 Linux (gcc4x) 但在 Windows (Visual C++ 2008 Express Edition) 下运行良好
Visual Studio 2008 Express Edition报表下的代码
error C2660: operator new[] : function does not take 1 arguments
class dummy{};
void* operator new[] (size_t size, dummy gcp)
{
return ::operator new[](size); //error
}
int main()
{
dummy dummyobj;
dummy* ptr = new (dummyobj) dummy[5];
return 0;
}
最佳答案
您可能需要 #include <new>
.
关于c++ - 错误运算符 new[] : function does not take 1 arguments,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3683740/