I need to find a workaround for the error with placing new in g ++. Now I have been fixed in gcc-4.3, but I need to support versions 4.2 and 4.1. For example, the following code compiles with an error
": there is no corresponding function to call the operator new (long unsigned int, void * &)"
template<class T, template<typename> class Alloc>
inline void* type_ctor()
{
Alloc<T> a; void* p = a.allocate(1);
new(p) T;
return p;
}
.....
type_ctor<A, NewAllocator >();
source
share