On Thursday 01 August 2002 1:31 pm, Lars Gullik Bjønnes wrote: > | Think of all those times when a BufferView * (or even a BufferView &) is > | passed to an inset. It makes no sense at all to pass a shared_ptr in > | these cases, but if the inset wants to cache this BufferView * then it > | can do so as > > This is where we disagree... it think it makes perfect sense to > _always_ pass a shared_ptr.
Well let's agree to differ on practical grounds then. I am /not/ going to change 10000 inset classes s/BufferView */boost::shared_ptr<BufferView> &/ plus all associated changes when perhaps one or two things might possibly want the shared_ptr not the thing it points to. Maybe if André's great unification project comes off then this would be easier since it looks like there'll be a single LyX inset that can hold any other inset, à la mathed. > And if the caller needs to cache the BufferView it should do that with > a weak_ptr. Yes. Anyway you've already shown me how to do this minimally. boost::shared_ptr<BufferView> const & LyXView::view() const { return bufferview_; } boost::weak_ptr<BufferView> cached_view; cached_view = bv->owner()->view(); Angus