On 03/21/2014 07:54 AM, Vincent van Ravesteijn wrote:
On Fri, Mar 21, 2014 at 12:33 PM, Jean-Marc Lasgouttes
<lasgout...@lyx.org <mailto:lasgout...@lyx.org>> wrote:
Here is something I stumbled upon yesterday: each Paragraph object
sores at least on copy of a Language object!
I have not quantify the cost of this thing, but it may be useful
to backport it to 2.1.x eventually.
Looking at the completion code shows a lot of other weird stuff,
like collecting words even when completion is not enabled, or
using too many new/delete for my taste, but this will be for later.
JMarc
Probably the Language class started out as a light-weight object. Now,
however, we store the complete layout translation in it, and thus
every Paragraph has a copy of this translation map, which indeed is
quite over-the-top.
On the other hand, I don't like using pointers instead. It feels
fragile to compare pointers. Why not just a "std::string language" as
the key ?
This would also be safer if, at some point down the road, someone
decided we needed to be able to reload languages on the fly.
Richard