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 /o3tl | |
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 'o3tl')
-rw-r--r-- | o3tl/qa/cow_wrapper_clients.cxx | 12 | ||||
-rw-r--r-- | o3tl/qa/cow_wrapper_clients.hxx | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/o3tl/qa/cow_wrapper_clients.cxx b/o3tl/qa/cow_wrapper_clients.cxx index 1ede35a2805d..913165c83c56 100644 --- a/o3tl/qa/cow_wrapper_clients.cxx +++ b/o3tl/qa/cow_wrapper_clients.cxx @@ -56,7 +56,7 @@ cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2& rSrc ) : { } -cow_wrapper_client2::cow_wrapper_client2( cow_wrapper_client2&& rSrc ) : +cow_wrapper_client2::cow_wrapper_client2( cow_wrapper_client2&& rSrc ) noexcept : maImpl( std::move( rSrc.maImpl ) ) { } @@ -68,7 +68,7 @@ cow_wrapper_client2& cow_wrapper_client2::operator=( const cow_wrapper_client2& return *this; } -cow_wrapper_client2& cow_wrapper_client2::operator=( cow_wrapper_client2&& rSrc ) +cow_wrapper_client2& cow_wrapper_client2::operator=(cow_wrapper_client2&& rSrc) noexcept { maImpl = std::move(rSrc.maImpl); @@ -134,7 +134,7 @@ cow_wrapper_client3::cow_wrapper_client3( const cow_wrapper_client3& rSrc ) : { } -cow_wrapper_client3::cow_wrapper_client3( cow_wrapper_client3&& rSrc ) : +cow_wrapper_client3::cow_wrapper_client3( cow_wrapper_client3&& rSrc ) noexcept : maImpl( std::move( rSrc.maImpl ) ) { } @@ -146,7 +146,7 @@ cow_wrapper_client3& cow_wrapper_client3::operator=( const cow_wrapper_client3& return *this; } -cow_wrapper_client3& cow_wrapper_client3::operator=( cow_wrapper_client3&& rSrc ) +cow_wrapper_client3& cow_wrapper_client3::operator=(cow_wrapper_client3&& rSrc) noexcept { maImpl = std::move(rSrc.maImpl); @@ -260,7 +260,7 @@ cow_wrapper_client5::cow_wrapper_client5( const cow_wrapper_client5& rSrc ) : { } -cow_wrapper_client5::cow_wrapper_client5( cow_wrapper_client5&& rSrc ) : +cow_wrapper_client5::cow_wrapper_client5( cow_wrapper_client5&& rSrc ) noexcept : maImpl( std::move( rSrc.maImpl ) ) { } @@ -276,7 +276,7 @@ cow_wrapper_client5& cow_wrapper_client5::operator=( const cow_wrapper_client5& return *this; } -cow_wrapper_client5& cow_wrapper_client5::operator=( cow_wrapper_client5&& rSrc ) +cow_wrapper_client5& cow_wrapper_client5::operator=(cow_wrapper_client5&& rSrc) noexcept { maImpl = std::move( rSrc.maImpl ); diff --git a/o3tl/qa/cow_wrapper_clients.hxx b/o3tl/qa/cow_wrapper_clients.hxx index e68dc231e424..36d77553b178 100644 --- a/o3tl/qa/cow_wrapper_clients.hxx +++ b/o3tl/qa/cow_wrapper_clients.hxx @@ -70,9 +70,9 @@ public: ~cow_wrapper_client2(); cow_wrapper_client2( const cow_wrapper_client2& ); - cow_wrapper_client2( cow_wrapper_client2&& ); + cow_wrapper_client2(cow_wrapper_client2&&) noexcept; cow_wrapper_client2& operator=( const cow_wrapper_client2& ); - cow_wrapper_client2& operator=( cow_wrapper_client2&& ); + cow_wrapper_client2& operator=(cow_wrapper_client2&&) noexcept; void modify( int nVal ); int queryUnmodified() const; @@ -101,9 +101,9 @@ public: ~cow_wrapper_client3(); cow_wrapper_client3( const cow_wrapper_client3& ); - cow_wrapper_client3( cow_wrapper_client3&& ); + cow_wrapper_client3(cow_wrapper_client3&&) noexcept; cow_wrapper_client3& operator=( const cow_wrapper_client3& ); - cow_wrapper_client3& operator=( cow_wrapper_client3&& ); + cow_wrapper_client3& operator=(cow_wrapper_client3&&) noexcept; void modify( int nVal ); int queryUnmodified() const; @@ -182,9 +182,9 @@ public: ~cow_wrapper_client5(); cow_wrapper_client5( const cow_wrapper_client5& ); - cow_wrapper_client5( cow_wrapper_client5&& ); + cow_wrapper_client5(cow_wrapper_client5&&) noexcept; cow_wrapper_client5& operator=( const cow_wrapper_client5& ); - cow_wrapper_client5& operator=( cow_wrapper_client5&& ); + cow_wrapper_client5& operator=(cow_wrapper_client5&&) noexcept; int queryUnmodified() const { return *maImpl; } sal_uInt32 use_count() const { return maImpl.use_count(); } |