summaryrefslogtreecommitdiff
path: root/include/o3tl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-03 14:29:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-06 08:16:24 +0200
commitbb2ff075642664084e735948fcc65e21ad861937 (patch)
treeec9db68195bb4af99609e1485d9bd16b453d253b /include/o3tl
parent49ea32064a28675a735fd270d07fd6ea8e7e03b6 (diff)
loplugin:useuniqueptr in SwHTMLPosFlyFrames
and add a new method erase_extract to o3tl::sorted_vector, otherwise there is no decent way to extract an element from such a vector without freeing it. Change-Id: I769782c04a54a2d7433e8349c99134f997a54689 Reviewed-on: https://gerrit.libreoffice.org/61345 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/o3tl')
-rw-r--r--include/o3tl/sorted_vector.hxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx
index 6e245353fe70..8324e333198a 100644
--- a/include/o3tl/sorted_vector.hxx
+++ b/include/o3tl/sorted_vector.hxx
@@ -97,6 +97,17 @@ public:
m_vector.begin() + (last - m_vector.begin()));
}
+ /**
+ * make erase return the removed element, otherwise there is no useful way of extracting a std::unique_ptr
+ * from this.
+ */
+ Value erase_extract( size_t index )
+ {
+ Value val = std::move(m_vector[index]);
+ m_vector.erase(m_vector.begin() + index);
+ return val;
+ }
+
void clear()
{
m_vector.clear();