On Wed, Jul 18, 2012 at 7:23 PM, Lubos Lunak <[email protected]> wrote: > > But it is correct that you get an error in the second case and you ideally > should be getting one in the first case as well. You cannot modify the > elements of the vector because that might modify what defines their position > in their sorted order, isn't that so? That is exactly the reason for those
Ummm. No. The sorted_vector class is not intended for storing primitive values. Virtually all of the use-cases create a custom comparator operation. Almost all of time, we are storing complex structs/classes in these vectors, and they have numerous fields that can and do need to be easily modifiable. Returning const-only references defeats that. So we end up having to cast away the const-ness most of the time, which makes the supposed protection worthless. _______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
