Jump to content
  • Advertisement
Sign in to follow this  
Sc4Freak

Smart pointer question

This topic is 3998 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!