Sign in to follow this  

containers and auto_ptr

This topic is 4821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know that you shouldn't put auto_ptr-like smart-pointers in STL containers because the containers aren't gauranteed by the standard not to make internal copies (which would, of course, screw up whatever they are making internal copies of). Now, if I want destructive-copy smart-pointers (like auto_ptr), do I have to make my own containers!? Is there a way around this weirdness?

Share this post


Link to post
Share on other sites
Use boost::shared_ptr instead (since it was designed for just that purpose); IIRC it's set to be included in the C++ standard, so you'll be ahead of the curve.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Why not just allocate an auto_ptr on the heap? ;)

Share this post


Link to post
Share on other sites

This topic is 4821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this