On Friday 06 September 2002 1:35 pm, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > | On Friday 06 September 2002 1:03 pm, Lars Gullik Bjønnes wrote: > | > Ok, the following update seems to fix that problem. > | > If you have time, please look at it again. > | > | @@ -191,6 +197,9 @@ private: > | > | /// > | FloatList floatlist_; > | + > | + /// > | + boost::shared_ptr<Counters> ctrs_; > | > | A minor point. Shouldn't this be > | + boost::shared_ptr<Counters> const ctrs_; > | > | showing future maintainers that you're using the shared_ptr only to avoid > | including counter.h in lyxtextclass.h. > > Perhaps... but how does adding const show that? (really)
It says that we set this once and once only in the c-tor "preamble" (whatever that : part outside the c-tor body is really called). > I also had trouble getting it to work... scoped_ptr was just out of > the question, it would have needed a lot of additional code to make it > work. Really? (To all the above points.) I have used the idiom in most of the classes in src/graphics without problems. Eg: class GraphicsCache { /// ~Cache(); /// Use the Pimpl idiom to hide the internals. class Impl; /// The pointer never changes although *pimpl_'s contents may. boost::scoped_ptr<Impl> const pimpl_; }; Just define the d-tor out-of-line. Angus