Add `noexcept` to move constructors and move assignment operators
refs #2966
Change-Id: Ib87da2b8dc2d77fa9beb8bc6b5323498057b76a2
diff --git a/src/util/scheduler-scoped-event-id.cpp b/src/util/scheduler-scoped-event-id.cpp
index c69af3b..2858749 100644
--- a/src/util/scheduler-scoped-event-id.cpp
+++ b/src/util/scheduler-scoped-event-id.cpp
@@ -25,12 +25,17 @@
namespace util {
namespace scheduler {
+#if NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE
+static_assert(std::is_nothrow_move_constructible<ScopedEventId>::value,
+ "ScopedEventId must be MoveConstructible with noexcept");
+#endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE
+
ScopedEventId::ScopedEventId(Scheduler& scheduler)
: m_scheduler(&scheduler)
{
}
-ScopedEventId::ScopedEventId(ScopedEventId&& other)
+ScopedEventId::ScopedEventId(ScopedEventId&& other) noexcept
: m_scheduler(other.m_scheduler)
, m_event(other.m_event)
{
diff --git a/src/util/scheduler-scoped-event-id.hpp b/src/util/scheduler-scoped-event-id.hpp
index 89cab89..1391d5d 100644
--- a/src/util/scheduler-scoped-event-id.hpp
+++ b/src/util/scheduler-scoped-event-id.hpp
@@ -42,7 +42,7 @@
/** \brief move constructor
*/
- ScopedEventId(ScopedEventId&& other);
+ ScopedEventId(ScopedEventId&& other) noexcept;
/** \brief assigns an event
*
diff --git a/src/util/signal-scoped-connection.cpp b/src/util/signal-scoped-connection.cpp
index a0f2d1c..1b1fb95 100644
--- a/src/util/signal-scoped-connection.cpp
+++ b/src/util/signal-scoped-connection.cpp
@@ -25,6 +25,11 @@
namespace util {
namespace signal {
+#if NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE
+static_assert(std::is_nothrow_move_constructible<ScopedConnection>::value,
+ "ScopedConnection must be MoveConstructible with noexcept");
+#endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE
+
ScopedConnection::ScopedConnection()
{
}
@@ -34,7 +39,7 @@
{
}
-ScopedConnection::ScopedConnection(ScopedConnection&& other)
+ScopedConnection::ScopedConnection(ScopedConnection&& other) noexcept
: m_connection(other.m_connection)
{
other.release();
diff --git a/src/util/signal-scoped-connection.hpp b/src/util/signal-scoped-connection.hpp
index 80717e5..04a4bb3 100644
--- a/src/util/signal-scoped-connection.hpp
+++ b/src/util/signal-scoped-connection.hpp
@@ -42,7 +42,7 @@
/** \brief move constructor
*/
- ScopedConnection(ScopedConnection&& other);
+ ScopedConnection(ScopedConnection&& other) noexcept;
/** \brief assigns a connection
*