
Hi again, I checked, and the code I posted before (here shown with small fixes to the syntax) doesn't work as I wanted, due to the two phase lookup that always finds global operator new instead of a possibly redefined one:
template<typename T> struct new_invoker : T { static void * alloc() { return operator new(sizeof(T)); } // should look up operator new in T scope before global scope static void dealloc(void *p) { return operator delete(p); } // should look up operator delete in T scope before global scope private: new_invoker(); new_invoker(new_invoker const &); ~new_invoker(); }; // specializations for non-class types omitted
-- __________________________________________________________________________ dott. Corrado Zoccolo mailto:zoccolo@di.unipi.it PhD - Department of Computer Science - University of Pisa, Italy -------------------------------------------------------------------------- The self-confidence of a warrior is not the self-confidence of the average man. The average man seeks certainty in the eyes of the onlooker and calls that self-confidence. The warrior seeks impeccability in his own eyes and calls that humbleness. Tales of Power - C. Castaneda