sorted_vector, constness, pointers, and structs

Noel Grandin noelgrandin at
Wed Jul 18 12:49:35 PDT 2012

On Wed, Jul 18, 2012 at 8:09 PM, Lubos Lunak <l.lunak at> wrote:
>  You didn't read further than that part above, did you?
>  What you want is broken. It is definitely broken from the theoretical point
> of view, since modifying the items may change the sort order.

Aaaaaargh. Instead of casting aspersions on my replies, how about you
actually read the o3tl::sorted_vector.hxx code and look at some of the
use-cases in the LO codebase.

What is broken is attempting to provide a level of protection that is
not useful in practice, mostly get bypassed, and does not play nice
with the C++ type-system.

Now, however, if you look at my original email, I make some
suggestions that will actually improve things.
For example, we can split the problem into 2 sub-use-cases
(a) sorted_vector_of_ptr_to_val
(b) sorted_vector_of_val
Then for each of these cases, we can apply some degree (but not a lot)
of const-protection

More information about the LibreOffice mailing list