Browse Source

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.
Timothy Flynn 1 year ago
parent
commit
c7ea710b55
1 changed files with 1 additions and 1 deletions
  1. 1 1
      AK/JsonValue.h

+ 1 - 1
AK/JsonValue.h

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