summaryrefslogtreecommitdiff
path: root/src/interned_string.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-10-28 20:01:27 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-10-28 20:01:27 +0000
commitd3091cb553283ad854ae61b5faf362a006bf3f6d (patch)
treeeb1c8bd10c8d18acf05a8bc414a69571f1aa02be /src/interned_string.hh
parent00aede6e577f024b50524c7c9cce87ae2a4f325b (diff)
Add noexcept spec to move constructor and move assign
Diffstat (limited to 'src/interned_string.hh')
-rw-r--r--src/interned_string.hh8
1 files changed, 5 insertions, 3 deletions
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<StringView, size_t> m_slot_map;
std::vector<size_t> m_free_slots;
@@ -62,8 +62,10 @@ public:
return *this;
}
- InternedString& operator=(InternedString&& str)
+ InternedString& operator=(InternedString&& str) noexcept
{
+ release_ifn();
+
static_cast<StringView&>(*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);