StonedCoder
Programmer
im trying to overload new[] for my own string class Cstr.
My code compiles on other compilers but not on msvc6.
anyone know how to get this working?
the error i get is new[] is not a member of global namespace.
I have the usual headers included and a using namespace std statement.
this is the function that errors.....
and by the way get same error for operator delete[]
My code compiles on other compilers but not on msvc6.
anyone know how to get this working?
the error i get is new[] is not a member of global namespace.
I have the usual headers included and a using namespace std statement.
this is the function that errors.....
and by the way get same error for operator delete[]
Code:
void* Cstr::operator new [] (size_t size) throw(std::bad_alloc)
{
void* memory;
try
{
memory=::operator new [] (size); // use global new to allocate memory
}
catch(std::bad_alloc&)
{
cerr<<endl<<"Out of memory.... aborting...."<<endl;
abort();
}
return memory; // if no exception thrown return pointer to allocated memory
}