summaryrefslogtreecommitdiff
path: root/include/com
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-12-20 16:59:44 +0100
committerStephan Bergmann <sbergman@redhat.com>2021-12-20 20:10:42 +0100
commit7cf387c43562a78192a59bd8fcfeea9b67d96f09 (patch)
treef4782fccdb96bc2ec538445c8ed9722908c63b2e /include/com
parente86734315c24d030f6cd9e8914c743a44ba35bd6 (diff)
Add css::uno::Sequence move assignment operator
Coverity had reported it as lacking, which b0b2d7f040c6a7c5dc1f3949693b368ca54ea3b5 "cid#1495784 Missing move assignment operator" and c4aa4b55e21915ca072daa7db93edabc043f26ab "cid#1495784 Missing move assignment operator" had worked around by instead modifying the calling code. But even though a move constructor would be of little benefit, a move assignment operator does have the slight performance benefit of avoiding some refcount manipulation, so add it anyway. Change-Id: Ibc9ca4557dd8beb6070b3451cb6103a8aadd10e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127188 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/com')
-rw-r--r--include/com/sun/star/uno/Sequence.h4
-rw-r--r--include/com/sun/star/uno/Sequence.hxx7
2 files changed, 11 insertions, 0 deletions
diff --git a/include/com/sun/star/uno/Sequence.h b/include/com/sun/star/uno/Sequence.h
index 4f481914c52b..1b9f6a2aac77 100644
--- a/include/com/sun/star/uno/Sequence.h
+++ b/include/com/sun/star/uno/Sequence.h
@@ -141,6 +141,10 @@ public:
*/
inline Sequence & SAL_CALL operator = ( const Sequence & rSeq );
+#if defined LIBO_INTERNAL_ONLY
+ inline Sequence & operator =(Sequence && other);
+#endif
+
/** Gets length of the sequence.
@return length of sequence
diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx
index 7aa873e91223..c078124f96fc 100644
--- a/include/com/sun/star/uno/Sequence.hxx
+++ b/include/com/sun/star/uno/Sequence.hxx
@@ -134,6 +134,13 @@ inline Sequence< E > & Sequence< E >::operator = ( const Sequence & rSeq )
return *this;
}
+#if defined LIBO_INTERNAL_ONLY
+template<typename E> Sequence<E> & Sequence<E>::operator =(Sequence && other) {
+ std::swap(_pSequence, other._pSequence);
+ return *this;
+}
+#endif
+
template< class E >
inline bool Sequence< E >::operator == ( const Sequence & rSeq ) const
{