summaryrefslogtreecommitdiffstats
path: root/include/o3tl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-09-12 20:10:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-09-13 08:13:59 +0200
commit4059583469c168c553d0529684caba6b281827d1 (patch)
treefdc1595c17d23156e97240e737f4a0e71ea56b5f /include/o3tl
parentstd::set->o3tl::sorted_vector in SwHistorySetAttrSet (diff)
downloadcore-4059583469c168c553d0529684caba6b281827d1.tar.gz
core-4059583469c168c553d0529684caba6b281827d1.zip
std::set->o3tl::sorted_vector in svx
Change-Id: I86154a8ddf885ea23ff29e4df1b67e7501b9165b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102536 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/o3tl')
-rw-r--r--include/o3tl/sorted_vector.hxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx
index 28ef75817fa7..803a044535e8 100644
--- a/include/o3tl/sorted_vector.hxx
+++ b/include/o3tl/sorted_vector.hxx
@@ -42,6 +42,7 @@ private:
typedef typename std::vector<Value>::iterator iterator;
public:
typedef typename std::vector<Value>::const_iterator const_iterator;
+ typedef typename std::vector<Value>::const_reverse_iterator const_reverse_iterator;
typedef typename std::vector<Value>::difference_type difference_type;
typedef typename std::vector<Value>::size_type size_type;
@@ -98,9 +99,9 @@ public:
}
// like C++ 2011: erase with const_iterator (doesn't change sort order)
- void erase(const_iterator const& position)
+ const_iterator erase(const_iterator const& position)
{ // C++98 has vector::erase(iterator), so call that
- m_vector.erase(m_vector.begin() + (position - m_vector.begin()));
+ return m_vector.erase(m_vector.begin() + (position - m_vector.begin()));
}
void erase(const_iterator const& first, const_iterator const& last)
@@ -159,6 +160,18 @@ public:
return m_vector.end();
}
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_reverse_iterator rbegin() const
+ {
+ return m_vector.rbegin();
+ }
+
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_reverse_iterator rend() const
+ {
+ return m_vector.rend();
+ }
+
const Value& front() const
{
return m_vector.front();