|
-
December 18th, 2003, 11:30 AM
#10
Originally posted by darwen
What are you trying to do here ?
The purpose of auto_ptr is to delete memory which you have newed e.g.
I'm declaring an auto_ptr< ifstream> variable in the header file of a class. At some point a new fstream is assigned to it. The purpose is to make sure the fstream gets destructed for sure. I've read in Effective C++ that the use of auto_ptr's is a way to ensure that. If I for example assign a new ifstream to this auto_ptr variable the old ifstream will get automatically deleted. To me it seams like a fool-proof way to avoid leaks?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|