18 Apr
2012
18 Apr
'12
10:46 a.m.
On 17-04-2012 17:42, Johannes Totz wrote:
On 17/04/2012 08:48, Thorsten Ottosen wrote:
On 16-04-2012 16:19, Johannes Totz wrote:
Hi all,
just started playing with boost::shared_ptr. How do I get a const iterator pointing to a shared_ptr pointing to a const object? See code below, I'd like to prevent a MyItem being changed through const iterators.
Maybe Boost.PtrContainer can be used. It doesn't allow shared ownership though.
Thanks for suggestion. All pointed-to objects are shared though...
Ok. Then maybe the best to do is to create a const-propagating shared_ptr. You can do so by A. inhirit privately or embed as member a shared ptr B. Implemenet -> and * in a const propagating manner. C. Implement other functions as needed. -Thorsten