When a function returns an auto_ptr<T> by value, but the caller does not store the return value; The auto_ptr<T>'s object will be automatically deleted, so there will be no memory leak.
Reference: Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions
No comments:
Post a Comment