1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

AK: Move String::~String() and String::destroy_string() to StringBase

This commit is contained in:
Dan Klishch 2023-10-28 15:42:33 -04:00 committed by Andrew Kaster
parent 54d149bc25
commit 1b09a1851e
4 changed files with 15 additions and 14 deletions

View file

@ -42,6 +42,12 @@ public:
StringBase& operator=(StringBase&&);
StringBase& operator=(StringBase const&);
constexpr ~StringBase()
{
if (!is_constant_evaluated())
destroy_string();
}
// NOTE: This is primarily interesting to unit tests.
[[nodiscard]] bool is_short_string() const;
@ -71,6 +77,9 @@ protected:
ShortString m_short_string;
Detail::StringData const* m_data { nullptr };
};
private:
void destroy_string();
};
}