diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-10-23 13:53:04 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-10-23 13:53:04 +0100 |
| commit | 5eb8989192445b0505933fcdb1c4f489d4bdc7f9 (patch) | |
| tree | f1b8bd15e89d1b077ebd57dee735d6425e243917 /src/interned_string.hh | |
| parent | 67a5493fa225fff87240ddb89e6a904f5e2f9267 (diff) | |
Fix slow InternedString copy constructor
Diffstat (limited to 'src/interned_string.hh')
| -rw-r--r-- | src/interned_string.hh | 11 |
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!=; |
