Smart pointer question

Started by
3 comments, last by Sc4Freak 16 years, 3 months ago
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;
NextWar: The Quest for Earth available now for Windows Phone 7.
Advertisement
1: The smart pointer itself. 2: The data it's pointing to.
Ah, thanks!
NextWar: The Quest for Earth available now for Windows Phone 7.
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.
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.
NextWar: The Quest for Earth available now for Windows Phone 7.

This topic is closed to new replies.

Advertisement