Skip to content

Commit e3efbcd

Browse files
committed
Cast padded_string to string_view instead of string
1 parent c14b2fb commit e3efbcd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/simdjson/inline/padded_string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ inline const char *padded_string::data() const noexcept { return data_ptr; }
9898

9999
inline char *padded_string::data() noexcept { return data_ptr; }
100100

101-
inline padded_string::operator std::string() const { return std::string(data(), length()); }
101+
inline padded_string::operator std::string_view() const { return std::string_view(data(), length()); }
102102

103103
inline simdjson_result<padded_string> padded_string::load(const std::string &filename) noexcept {
104104
// Open the file

include/simdjson/padded_string.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ struct padded_string final {
9090
char *data() noexcept;
9191

9292
/**
93-
* Create a new std::string with the same content.
93+
* Create a std::string_view with the same content.
9494
*/
95-
operator std::string() const;
95+
operator std::string_view() const;
9696

9797
/**
9898
* Load this padded string from a file.

0 commit comments

Comments
 (0)