From 7cf387c43562a78192a59bd8fcfeea9b67d96f09 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann <sbergman@redhat.com> Date: Mon, 20 Dec 2021 16:59:44 +0100 Subject: 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> --- include/com/sun/star/uno/Sequence.h | 4 ++++ include/com/sun/star/uno/Sequence.hxx | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'include/com') 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 { -- cgit