summaryrefslogtreecommitdiff
path: root/src/interned_string.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-10-23 13:53:04 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-10-23 13:53:04 +0100
commit5eb8989192445b0505933fcdb1c4f489d4bdc7f9 (patch)
treef1b8bd15e89d1b077ebd57dee735d6425e243917 /src/interned_string.hh
parent67a5493fa225fff87240ddb89e6a904f5e2f9267 (diff)
Fix slow InternedString copy constructor
Diffstat (limited to 'src/interned_string.hh')
-rw-r--r--src/interned_string.hh11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/interned_string.hh b/src/interned_string.hh
index d21ce26f..b280fde9 100644
--- a/src/interned_string.hh
+++ b/src/interned_string.hh
@@ -31,7 +31,11 @@ class InternedString : public StringView
public:
InternedString() = default;
- InternedString(const InternedString& str) { acquire_ifn(str); }
+ InternedString(const InternedString& str) : InternedString(str, str.m_slot)
+ {
+ if (m_slot != -1)
+ StringRegistry::instance().acquire(m_slot);
+ }
InternedString(InternedString&& str) : StringView(str)
{
@@ -71,11 +75,6 @@ public:
release_ifn();
}
- bool operator==(const InternedString& str) const
- { return data() == str.data() && length() == str.length(); }
- bool operator!=(const InternedString& str) const
- { return !(*this == str); }
-
using StringView::operator==;
using StringView::operator!=;