From e3efbcddc1ee283fc5fdc707a1fdcf76b414b159 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Fri, 27 Mar 2020 09:13:11 -0700 Subject: [PATCH] Cast padded_string to string_view instead of string --- include/simdjson/inline/padded_string.h | 2 +- include/simdjson/padded_string.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/simdjson/inline/padded_string.h b/include/simdjson/inline/padded_string.h index 9e3ee63bf..8caed20af 100644 --- a/include/simdjson/inline/padded_string.h +++ b/include/simdjson/inline/padded_string.h @@ -98,7 +98,7 @@ inline const char *padded_string::data() const noexcept { return data_ptr; } inline char *padded_string::data() noexcept { return data_ptr; } -inline padded_string::operator std::string() const { return std::string(data(), length()); } +inline padded_string::operator std::string_view() const { return std::string_view(data(), length()); } inline simdjson_result padded_string::load(const std::string &filename) noexcept { // Open the file diff --git a/include/simdjson/padded_string.h b/include/simdjson/padded_string.h index 2c71c2611..8872460c8 100644 --- a/include/simdjson/padded_string.h +++ b/include/simdjson/padded_string.h @@ -90,9 +90,9 @@ struct padded_string final { char *data() noexcept; /** - * Create a new std::string with the same content. + * Create a std::string_view with the same content. */ - operator std::string() const; + operator std::string_view() const; /** * Load this padded string from a file.