From 63dfd069b3a957361881c12ccba38c5a23b9a42f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 22 Aug 2019 15:42:36 +0300 Subject: Mark move ctors/assignments noexcept This should enable using move semantics where possible e.g. in standard containers. According to https://en.cppreference.com/w/cpp/language/move_constructor: To make strong exception guarantee possible, user-defined move constructors should not throw exceptions. For example, std::vector relies on std::move_if_noexcept to choose between move and copy when the elements need to be relocated. Change-Id: I6e1e1cdd5cd430b139ffa2fa7031fb0bb625decb Reviewed-on: https://gerrit.libreoffice.org/77957 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- comphelper/source/misc/namedvaluecollection.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'comphelper/source') diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx index 777e75e57a86..768f1f610e5d 100644 --- a/comphelper/source/misc/namedvaluecollection.cxx +++ b/comphelper/source/misc/namedvaluecollection.cxx @@ -64,7 +64,7 @@ namespace comphelper *this = _rCopySource; } - NamedValueCollection::NamedValueCollection( NamedValueCollection&& _rCopySource ) + NamedValueCollection::NamedValueCollection(NamedValueCollection&& _rCopySource) noexcept :m_pImpl( std::move(_rCopySource.m_pImpl) ) { } @@ -75,7 +75,7 @@ namespace comphelper return *this; } - NamedValueCollection& NamedValueCollection::operator=( NamedValueCollection&& i_rCopySource ) + NamedValueCollection& NamedValueCollection::operator=(NamedValueCollection&& i_rCopySource) noexcept { m_pImpl = std::move(i_rCopySource.m_pImpl); return *this; -- cgit v1.2.3