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:
parent
54d149bc25
commit
1b09a1851e
4 changed files with 15 additions and 14 deletions
|
@ -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();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue