Jump to content
  • Advertisement
Sign in to follow this  
Sc4Freak

Smart pointer question

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

Let's say I have the following:
const boost::shared_ptr<int> x;
What's const? The smart pointer itself, or the data it's pointing to? And what about this:
boost::shared_ptr<const int> x;

Share this post


Link to post
Share on other sites
Advertisement
It's exactly what it looks like, if you read < as "to" and > as "".

a const smart pointer to an int; a smart pointer to a const int.

Share this post


Link to post
Share on other sites
Well, the confusion came from regular pointer syntax:

const int* x

Means that the the data pointed to by x is const, not x itself.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!