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:28:36 +0100 |
commit | c59355e936446fe55960209e543b072acb6b2170 (patch) | |
tree | dbac8219876d47a0f4f60a6ce5a84015f7da5358 /o3tl | |
parent | sw: FN_FORMAT_RESET: do not reset Ruby text (diff) | |
download | core-c59355e936446fe55960209e543b072acb6b2170.tar.gz core-c59355e936446fe55960209e543b072acb6b2170.zip |
fdo#58793: re-implement SwpHintsArray::Resort():
The previous implementation uses sorted_vector::insert, which relies on
the array already being sorted.
Change-Id: I4a2e49e7d8fcfd934f8990be61f83d00d1a09ddd
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> |