Sign in to follow this  
theark

Understanding the concept of Smart Pointers

Recommended Posts

theark    336
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

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