1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-01 11:39:22 +00:00

AK: Return a constant reference from JsonValue::as_string

Rather than making a copy of the held string, this returns a reference
so that expressions like the following:

    do_something(json.as_string().view());

are not disallowed once `ByteString::view() &&` is deleted.
This commit is contained in:
Timothy Flynn 2024-04-03 21:28:20 -04:00 committed by Andreas Kling
parent 6d38d55fc8
commit c7ea710b55

View File

@ -128,7 +128,7 @@ public:
return m_value.get<bool>();
}
ByteString as_string() const
ByteString const& as_string() const
{
return m_value.get<ByteString>();
}