passing a ointer results in a copy being pushed on the stack.
you don't want the copy, so pass the argument by reference:
|
Source code
|
1
2
3
4
5
|
template< class T >
void my_new( T*& p ){ p = new T(); }
template< class T >
void my_delete( T*& p ){ delete p; p = 0; }
|