Difference between `const shared_ptr<T>` and `shared_ptr<const T>`?
I'm writing an accessor method for a shared pointer in C++ that goes something like this: class Foo { public: return_type getBar() const { return m_bar; } private: boost::shared_ptr<Bar> m_bar; } So to support the const-ness of getBar() the return type should be a boost::shared_ptr that prevents modification of the Bar it points to. My guess is that shared_ptr<const Bar> is the type I want to return to do that, whereas const shared_ptr<Bar> would prevent reassignment of the pointer itself to point to a different Bar but allow modification of the Bar that it points to... However, I'm not sure.