summaryrefslogtreecommitdiff
path: root/o3tl
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-01-11 11:04:31 +0100
committerMichael Stahl <mstahl@redhat.com>2013-01-11 11:28:36 +0100
commitc59355e936446fe55960209e543b072acb6b2170 (patch)
treedbac8219876d47a0f4f60a6ce5a84015f7da5358 /o3tl
parent689d9af3e3adb12c507e141cc25ac35ec88bb5c5 (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
Diffstat (limited to 'o3tl')
-rw-r--r--o3tl/inc/o3tl/sorted_vector.hxx12
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>