mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:17:34 +00:00
StringView: Make construction of String from a StringView containing a String cheaper
... at the cost of an additional pointer per view.
This commit is contained in:
parent
8fecc0eaee
commit
f9ba7adae2
3 changed files with 9 additions and 3 deletions
|
@ -36,9 +36,12 @@ public:
|
|||
|
||||
String() {}
|
||||
|
||||
String(StringView view)
|
||||
: m_impl(StringImpl::create(view.characters(), view.length()))
|
||||
String(const StringView& view)
|
||||
{
|
||||
if (view.m_string)
|
||||
*this = String(*view.m_string);
|
||||
else
|
||||
m_impl = StringImpl::create(view.characters(), view.length());
|
||||
}
|
||||
|
||||
String(const String& other)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue