Skip to content

Commit

Permalink
Json read string view (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
aligirayhanozbay authored Dec 22, 2024
1 parent 896c4a4 commit 7affb4e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/rfl/json/read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#endif

#include <istream>
#include <string>
#include <string_view>

#include "../Processors.hpp"
#include "../internal/wrap_in_rfl_array_t.hpp"
Expand All @@ -30,8 +30,8 @@ auto read(const InputVarType& _obj) {

/// Parses an object from JSON using reflection.
template <class T, class... Ps>
Result<internal::wrap_in_rfl_array_t<T>> read(const std::string& _json_str) {
yyjson_doc* doc = yyjson_read(_json_str.c_str(), _json_str.size(), 0);
Result<internal::wrap_in_rfl_array_t<T>> 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");
}
Expand Down

0 comments on commit 7affb4e

Please sign in to comment.