mirror of
https://github.com/monero-project/monero.git
synced 2025-08-13 07:25:30 -04:00
Merge pull request #6559
15538f7
ByteSlice: Fix persisting ptr to std::moved SSO buffer (Doy-lee)
This commit is contained in:
commit
35e2520115
2 changed files with 27 additions and 1 deletions
|
@ -133,10 +133,13 @@ namespace epee
|
|||
|
||||
template<typename T>
|
||||
byte_slice::byte_slice(const adapt_buffer, T&& buffer)
|
||||
: storage_(nullptr), portion_(to_byte_span(to_span(buffer)))
|
||||
: storage_(nullptr), portion_(nullptr)
|
||||
{
|
||||
if (!buffer.empty())
|
||||
{
|
||||
storage_ = allocate_slice<adapted_byte_slice<T>>(0, std::move(buffer));
|
||||
portion_ = to_byte_span(to_span(static_cast<adapted_byte_slice<T> *>(storage_.get())->buffer));
|
||||
}
|
||||
}
|
||||
|
||||
byte_slice::byte_slice(std::initializer_list<span<const std::uint8_t>> sources)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue