About SwSortedObjs

Miklos Vajna vmiklos at collabora.co.uk
Sat Mar 22 06:54:38 PDT 2014

Hi Julien,

On Sat, Mar 22, 2014 at 06:47:05AM -0700, julien2412 <serval2412 at yahoo.fr> wrote:
> The [] operator is to retrieve the nth element of the sorted vector. I don't
> figure out how map would replace vector here? What key to use?

Nah, you just mentioned in general, that you would need a set (which is
a sorted container where the key is not separated from the value) which
has an operator[], and I believe map is just that.

> Above all, do you think it worths it to spend some time on searching a way
> to replace the vector implementation or am I misleading? I must recognize
> it's just some guessing, I haven't profiled anything.

First, if you want to improve performance, then please always profile,
premature optimization just makes the code more complex without too much
benefits. :-)

Second, the logic to decide how to sort an SwSortedObj seems to be
ObjAnchorOrder (sw/source/core/layout/sortedobjs.cxx), if you want to
replace SwSortedObjs with something more generic, maybe use
o3tl::sorted_vector for this purpose?

That works quite well for e.g. SwRedlineTbl already.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20140322/04bd2888/attachment.sig>

More information about the LibreOffice mailing list