diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-28 15:57:38 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-28 20:09:19 +0200 |
commit | c131f32fcfff1208adc38536839bc5168fcb7487 (patch) | |
tree | 15281689e85827f04af03349032f91196c3e7c29 /include/com | |
parent | gtk[3 vs 4]: remove can-focus entirely from toolbarpopover.ui (diff) | |
download | core-c131f32fcfff1208adc38536839bc5168fcb7487.tar.gz core-c131f32fcfff1208adc38536839bc5168fcb7487.zip |
Prepare for removal of non-const operator[] from Sequence in include
Change-Id: I85ca453f3add5ac5b59dc6f1ccb2cdb55f0a463c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124333
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/com')
-rw-r--r-- | include/com/sun/star/uno/Sequence.hxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx index 5356872b1378..73e51a9bc7f5 100644 --- a/include/com/sun/star/uno/Sequence.hxx +++ b/include/com/sun/star/uno/Sequence.hxx @@ -295,8 +295,9 @@ template <class E> inline auto asNonConstRange(css::uno::Sequence<E>& s) // These allow to pass it as range-expression to range-based for loops E* begin() { return std::pair<E*, E*>::first; } E* end() { return std::pair<E*, E*>::second; } + E& operator[](sal_Int32 i) { assert(i >= 0 && i < end() - begin()); return begin()[i]; } }; - return SequenceRange(s.getArray(), s.getLength()); + return SequenceRange(s.getLength() ? s.getArray() : nullptr, s.getLength()); }; /// @endcond |