mirror of
https://github.com/yuzu-emu/sirit
synced 2024-11-22 16:44:00 +00: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]);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include "common_types.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@ public:
|
|||
explicit Stream(std::vector<u8>& bytes);
|
||||
~Stream();
|
||||
|
||||
void Write(std::string string);
|
||||
void Write(std::string_view string);
|
||||
|
||||
void Write(u64 value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue