Sign in to follow this  

Understanding the concept of Smart Pointers

This topic is 1899 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

The title, likely doesn't do much justice to what my question is, and i'll try to be as a descriptive as I possibly can be.

My issue, is not more on misunderstanding Smart Pointers, but rather, a small glitch in trying to get my head around them. I know smart pointers are used for dynamically creating objects, and that they manage the destruction of these objects, and keep a reference to them using reference counting. But, what I struggle to understand is when I should use these, should I, for example use the [b]std::tr1::shared_ponter<>[/b], for everything.. or just large game sub-systems that need to be referenced by other systems in my game? Such as my graphics rendering system that will need to be used by other parts of my game.. or scene management, etc.. (These are just examples).

Also, where do weak pointers fit into this, when should a weak pointer be used instead of a shared pointer?

I hope my question makes sense, i'll try to clarify anything that doesn't.

Regards
and thanks.

Share this post


Link to post
Share on other sites
That makes sense, thank you, to you both. I'll note this down, so I don't forget it.

Cheers.

Share this post


Link to post
Share on other sites

This topic is 1899 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