mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2025-12-28 18:26:54 +01:00
stream: Change std::string overload for Write to use a std::string_view
Allows various string types to be used with the overload without constructing a std::string (such as const char* etc).
This commit is contained in:
parent
326c69896b
commit
59f795bd6d
2 changed files with 4 additions and 4 deletions
|
|
@ -12,9 +12,9 @@ Stream::Stream(std::vector<u8>& bytes) : bytes(bytes) {}
|
|||
|
||||
Stream::~Stream() = default;
|
||||
|
||||
void Stream::Write(std::string string) {
|
||||
void Stream::Write(std::string_view string) {
|
||||
const auto size{string.size()};
|
||||
const auto data{reinterpret_cast<u8*>(string.data())};
|
||||
const auto data{reinterpret_cast<const u8*>(string.data())};
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
Write(data[i]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue