Skip to content

Commit 4824bb5

Browse files
committed
trackable: Make move operations noexcept.
I don't think there is any reason not to. Noticed by clang-tidy.
1 parent 54dcd80 commit 4824bb5

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

sigc++/trackable.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ trackable::trackable(const trackable& /*src*/) noexcept : callback_list_(nullptr
3838
//
3939
// If trackable's move constructor is modified, check if Glib::Object's
4040
// move constructor should be modified similarly.
41-
trackable::trackable(trackable&& src) : callback_list_(nullptr)
41+
trackable::trackable(trackable&& src) noexcept
42+
: callback_list_(nullptr)
4243
{
4344
src.notify_callbacks();
4445
}
@@ -53,7 +54,7 @@ trackable::operator=(const trackable& src)
5354
}
5455

5556
trackable&
56-
trackable::operator=(trackable&& src)
57+
trackable::operator=(trackable&& src) noexcept
5758
{
5859
if (this != &src)
5960
{

sigc++/trackable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ struct SIGC_API trackable : public notifiable
125125

126126
trackable(const trackable& src) noexcept;
127127

128-
trackable(trackable&& src);
128+
trackable(trackable&& src) noexcept;
129129

130130
trackable& operator=(const trackable& src);
131131

132-
trackable& operator=(trackable&& src);
132+
trackable& operator=(trackable&& src) noexcept;
133133

134134
~trackable();
135135

tests/test_trackable_move.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ class my_class : public sigc::trackable
1818
my_class(const my_class& src) = delete;
1919
my_class& operator=(const my_class& src) = delete;
2020

21-
my_class(my_class&& src) : sigc::trackable(std::move(src)), i(std::move(src.i)) { src.i = 0; }
21+
my_class(my_class&& src) noexcept
22+
: sigc::trackable(std::move(src)), i(std::move(src.i)) {
23+
src.i = 0;
24+
}
2225

2326
my_class& operator=(my_class&& src)
2427
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy