diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-01-11 11:04:31 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-01-11 11:37:44 +0100 |
commit | cdd0555aefa0a01d0d90fed8640811c5601f314e (patch) | |
tree | a67106478e051ba264ac8d4cfb85ba1f2d31e603 /o3tl | |
parent | 5d1137fce2329ff463d11b46ee31ec210254445c (diff) |
fdo#58793: re-implement SwpHintsArray::Resort():
The previous implementation uses sorted_vector::insert, which relies on
the array already being sorted.
Change-Id: I4a2e49e7d8fcfd934f8990be61f83d00d1a09ddd
(cherry picked from commit c59355e936446fe55960209e543b072acb6b2170)
Signed-off-by: Thorsten Behrens <tbehrens@suse.com>
Diffstat (limited to 'o3tl')
-rw-r--r-- | o3tl/inc/o3tl/sorted_vector.hxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/o3tl/inc/o3tl/sorted_vector.hxx b/o3tl/inc/o3tl/sorted_vector.hxx index d8bceb72e39d..3028f03e1a02 100644 --- a/o3tl/inc/o3tl/sorted_vector.hxx +++ b/o3tl/inc/o3tl/sorted_vector.hxx @@ -155,6 +155,16 @@ public: clear(); } + // fdo#58793: some existing code in Writer (SwpHintsArray) + // routinely modifies the members of the vector in a way that + // violates the sort order, and then re-sorts the array. + // This is a kludge to enable that code to work. + // If you are calling this function, you are Doing It Wrong! + void Resort() + { + std::stable_sort(begin_nonconst(), end_nonconst(), Compare()); + } + private: typename base_t::iterator begin_nonconst() { return base_t::begin(); } @@ -191,7 +201,7 @@ struct find_unique } }; -/** the elments are partially ordered by Compare, +/** the elements are partially ordered by Compare, 2 elements are allowed if they are not the same element (pointer equal) */ template<class Value, class Compare> |