Jump to content
  • Advertisement
Sign in to follow this  
Sc4Freak

Smart pointer question

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!