diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-22 15:42:36 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-23 11:48:53 +0200 |
commit | 63dfd069b3a957361881c12ccba38c5a23b9a42f (patch) | |
tree | e7a9bd1027b19f44a7c58ea9c445ded435c838bc /svl | |
parent | 61ed17cafc90d9b4303b52260f729638eed107c7 (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/itemset.cxx | 2 | ||||
-rw-r--r-- | svl/source/misc/sharedstring.cxx | 4 | ||||
-rw-r--r-- | svl/source/svdde/ddedata.cxx | 4 | ||||
-rw-r--r-- | svl/unx/source/svdde/ddedummy.cxx | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index 1faf57230a58..35da205612ac 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -216,7 +216,7 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet ) memcpy( m_pWhichRanges, rASet.m_pWhichRanges, sizeof( sal_uInt16 ) * cnt); } -SfxItemSet::SfxItemSet( SfxItemSet&& rASet ) +SfxItemSet::SfxItemSet(SfxItemSet&& rASet) noexcept : m_pPool( rASet.m_pPool ) , m_pParent( rASet.m_pParent ) , m_pItems( std::move(rASet.m_pItems) ) diff --git a/svl/source/misc/sharedstring.cxx b/svl/source/misc/sharedstring.cxx index 97c22aa72942..9aff3eb0eab5 100644 --- a/svl/source/misc/sharedstring.cxx +++ b/svl/source/misc/sharedstring.cxx @@ -44,7 +44,7 @@ SharedString::SharedString( const SharedString& r ) : mpData(r.mpData), mpDataIg rtl_uString_acquire(mpDataIgnoreCase); } -SharedString::SharedString( SharedString&& r ) : mpData(r.mpData), mpDataIgnoreCase(r.mpDataIgnoreCase) +SharedString::SharedString(SharedString&& r) noexcept : mpData(r.mpData), mpDataIgnoreCase(r.mpDataIgnoreCase) { r.mpData = nullptr; r.mpDataIgnoreCase = nullptr; @@ -79,7 +79,7 @@ SharedString& SharedString::operator= ( const SharedString& r ) return *this; } -SharedString& SharedString::operator= ( SharedString&& r ) +SharedString& SharedString::operator=(SharedString&& r) noexcept { if (mpData) rtl_uString_release(mpData); diff --git a/svl/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx index cb12b415a8eb..c57de4a9ac0b 100644 --- a/svl/source/svdde/ddedata.cxx +++ b/svl/source/svdde/ddedata.cxx @@ -67,7 +67,7 @@ DdeData::DdeData(const DdeData& rData) Lock(); } -DdeData::DdeData(DdeData&& rData) +DdeData::DdeData(DdeData&& rData) noexcept : xImp(std::move(rData.xImp)) { } @@ -115,7 +115,7 @@ DdeData& DdeData::operator=(const DdeData& rData) return *this; } -DdeData& DdeData::operator=(DdeData&& rData) +DdeData& DdeData::operator=(DdeData&& rData) noexcept { xImp = std::move(rData.xImp); return *this; diff --git a/svl/unx/source/svdde/ddedummy.cxx b/svl/unx/source/svdde/ddedummy.cxx index 31cb24aa6c37..2e633f895722 100644 --- a/svl/unx/source/svdde/ddedummy.cxx +++ b/svl/unx/source/svdde/ddedummy.cxx @@ -40,7 +40,7 @@ DdeData::DdeData(const DdeData&) { } -DdeData::DdeData(DdeData&&) +DdeData::DdeData(DdeData&&) noexcept { } @@ -66,7 +66,7 @@ DdeData& DdeData::operator=(const DdeData&) return *this; } -DdeData& DdeData::operator=(DdeData&&) +DdeData& DdeData::operator=(DdeData&&) noexcept { return *this; } |