From 7affb4e421e106b19f14468ae246e273ddcaa783 Mon Sep 17 00:00:00 2001 From: aligirayhanozbay <44897017+aligirayhanozbay@users.noreply.github.com> Date: Sun, 22 Dec 2024 19:55:09 +0000 Subject: [PATCH] Json read string view (#312) --- include/rfl/json/read.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/rfl/json/read.hpp b/include/rfl/json/read.hpp index 359a20fb..c4465498 100644 --- a/include/rfl/json/read.hpp +++ b/include/rfl/json/read.hpp @@ -8,7 +8,7 @@ #endif #include -#include +#include #include "../Processors.hpp" #include "../internal/wrap_in_rfl_array_t.hpp" @@ -30,8 +30,8 @@ auto read(const InputVarType& _obj) { /// Parses an object from JSON using reflection. template -Result> read(const std::string& _json_str) { - yyjson_doc* doc = yyjson_read(_json_str.c_str(), _json_str.size(), 0); +Result> read(std::string_view const _json_str) { + yyjson_doc* doc = yyjson_read(_json_str.data(), _json_str.size(), 0); if (!doc) { return Error("Could not parse document"); }