diff --git a/src/interned_string.cc b/src/interned_string.cc index b949233f..1a7b5627 100644 --- a/src/interned_string.cc +++ b/src/interned_string.cc @@ -40,7 +40,7 @@ void StringRegistry::acquire(size_t slot) ++m_storage[slot].second; } -void StringRegistry::release(size_t slot) +void StringRegistry::release(size_t slot) noexcept { if (--m_storage[slot].second == 0) { diff --git a/src/interned_string.hh b/src/interned_string.hh index 23eeab92..43df5fb4 100644 --- a/src/interned_string.hh +++ b/src/interned_string.hh @@ -18,7 +18,7 @@ private: InternedString acquire(StringView str); void acquire(size_t slot); - void release(size_t slot); + void release(size_t slot) noexcept; std::unordered_map m_slot_map; std::vector m_free_slots; @@ -62,8 +62,10 @@ public: return *this; } - InternedString& operator=(InternedString&& str) + InternedString& operator=(InternedString&& str) noexcept { + release_ifn(); + static_cast(*this) = str; m_slot = str.m_slot; str.m_slot = -1; @@ -110,7 +112,7 @@ private: *this = StringRegistry::instance().acquire(str); } - void release_ifn() + void release_ifn() noexcept { if (m_slot != -1) StringRegistry::instance().release(m_slot); diff --git a/src/optional.hh b/src/optional.hh index 68277b1a..3f919043 100644 --- a/src/optional.hh +++ b/src/optional.hh @@ -20,6 +20,7 @@ public: } Optional(Optional&& other) + noexcept(noexcept(new ((void*)0) T(std::move(other.m_value)))) : m_valid(other.m_valid) { if (m_valid) diff --git a/src/safe_ptr.hh b/src/safe_ptr.hh index 6a53a02e..ac3af21d 100644 --- a/src/safe_ptr.hh +++ b/src/safe_ptr.hh @@ -29,7 +29,7 @@ public: #endif } safe_ptr(const safe_ptr& other) : safe_ptr(other.m_ptr) {} - safe_ptr(safe_ptr&& other) : m_ptr(other.m_ptr) + safe_ptr(safe_ptr&& other) noexcept : m_ptr(other.m_ptr) { other.m_ptr = nullptr; #ifdef KAK_DEBUG @@ -60,7 +60,7 @@ public: return *this; } - safe_ptr& operator=(safe_ptr&& other) + safe_ptr& operator=(safe_ptr&& other) noexcept { #ifdef KAK_DEBUG if (m_ptr)