17 Apr
2012
17 Apr
'12
4:27 p.m.
IIUC, the following answers your question: http://www.boost.org/doc/libs/1_49_0/libs/smart_ptr/shared_ptr.htm#FAQ <
() const, but its return value is a non-const pointer to the element type? A. Shallow copy pointers, including raw pointers, typically don't propagate constness. It makes little sense for them to do so, as you can always obtain a non-const pointer from a const one and then proceed to modify the object through it.shared_ptr is "as close to raw pointers as possible but no closer".>> Got a recommendation as to how to get this const-correct? I'm kinda clueless right now... Or does the above faq mean it just cant be done?
I'm afraid it can't be done with shared ptr.