Abdelrazak Younes wrote:
Richard Heck wrote:
This got started because there was a crash that involved passing a
temporary to Paragraph::setLayout(), and I added a comment to the
effect that one ought not to do that. Then Andre suggested there must
be a better way, in particular, that maybe we could make Layout's
constructor private, etc. Unfortunately, you can't do that, because we
have a std::vector of Layout's.
What's wrong with a vector<Layout *> and a private Layout ctor? You just
need to declare TextClass as friend in the layout class, that's all. I
probably missed something...
I had a look at TextClass, I think that the public typedef (LayoutList
and const_iterator) are not really needed. They are only used in
GuiToolbars.cpp and GuiDocument.cpp; we can write TextClass helper
methods for those cases.
Then, if you don't need the public iterator interface, there's nothing
stopping us from using vector<Layout *>, AFAICS from q quick glance.
Abdel.