11 Jan
2006
11 Jan
'06
5:22 a.m.
Suppose I have this function in c++: int* f(int size) { int * array = new int[size]; return array; } Is there a safe idiom to prevent memory leak? Should i use auto_ptr in C++? Or should I use the smart pointer library in boost? Which is the simplest solution? Thank you.