rgheck wrote:
Andre Poenitz wrote:
On Mon, Feb 25, 2008 at 04:50:42PM -0500, rgheck wrote:
In my last commit regarding boost::shared_ptr, I left TextClassPtr as a silly typedef:
   typedef TextClass * TextClassPtr;
...

Comments welcome.

I personally don't like this TextClassPtr class. 'TextClass *' is meaningful enough. I would suggest to get rid of the TextClassPtr header altogether now.


How many of those TextClass beasts appear in a typical LyX session?
Two? A dozen? Hundreds?

Maybe half a dozen. So it's not a lot.

Can't TextClassBundle not just be a std::list<TextClass>
This might be possible, but there are cases (such as in InsetCollapsable) where we have (and did have, before my stuff) default arguments like: TextClassPtr tc = 0.

But I understand now that a TextClass is mandatory now, isn't it? So using a reference instead of a pointer is better. Pointers are good if the referenced instance is not mandatory. For example GuiView::current_work_area_ is a pointer but BufferView::buffer_ is a reference.


And there are classes, like BufferParam, but others too, that have TextClassPtr's as members, where it's more sensible to have a null pointer as initial object.

Why? If a TextClass is mandatory, give it the default one at construction IMHO. So a reference would work as well.

You'll have to help me out here. BufferParams holds a something to its TextClass---presently a pointer---and that is the main use of this structure. Can it hold a reference: viz, private: TextClass & text_class_?

Sure.

If not---and I don't remember ever seeing this---

See BufferView::buffer_ for example.

Abdel.

Reply via email to