encoding+util: ensure move constructors are properly declared
This also fixes a race condition in scheduler::EventId::operator bool()
Change-Id: I468f0c46039a3d1a38c69c419ae45b4445d8205a
Refs: #3414
diff --git a/src/util/scheduler.hpp b/src/util/scheduler.hpp
index 79fbf23..bd4467a 100644
--- a/src/util/scheduler.hpp
+++ b/src/util/scheduler.hpp
@@ -57,7 +57,8 @@
* \brief Constructs an empty EventId
* \note EventId is implicitly convertible from nullptr.
*/
- EventId(std::nullptr_t = nullptr)
+ constexpr
+ EventId(std::nullptr_t = nullptr) noexcept
{
}
@@ -66,16 +67,16 @@
* \retval false This EventId is empty, or the event is expired or cancelled.
*/
explicit
- operator bool() const;
+ operator bool() const noexcept;
/**
* \return whether this and other refer to the same event, or are both empty/expired/cancelled
*/
bool
- operator==(const EventId& other) const;
+ operator==(const EventId& other) const noexcept;
bool
- operator!=(const EventId& other) const
+ operator!=(const EventId& other) const noexcept
{
return !this->operator==(other);
}
@@ -86,15 +87,15 @@
* \post !(*this)
*/
void
- reset()
+ reset() noexcept
{
m_info.reset();
}
private:
explicit
- EventId(const weak_ptr<EventInfo>& info)
- : m_info(info)
+ EventId(weak_ptr<EventInfo> info) noexcept
+ : m_info(std::move(info))
{
}
@@ -112,7 +113,7 @@
{
public:
bool
- operator()(const shared_ptr<EventInfo>& a, const shared_ptr<EventInfo>& b) const;
+ operator()(const shared_ptr<EventInfo>& a, const shared_ptr<EventInfo>& b) const noexcept;
};
using EventQueue = std::multiset<shared_ptr<EventInfo>, EventQueueCompare>;