浏览代码

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 年之前
父节点
当前提交
c7ea710b55
共有 1 个文件被更改,包括 1 次插入1 次删除
  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>();
     }