1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-25 20:41:49 +03:00

Fix slow InternedString copy constructor

This commit is contained in:
Maxime Coste 2014-10-23 13:53:04 +01:00
parent 67a5493fa2
commit 5eb8989192

View File

@ -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!=;