mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 09:43:55 +02:00
refactor: Return std::span from MakeByteSpan
In theory this commit should only touch the span.h header, because std::span can implicilty convert into Span in most places, if needed. However, at least when using the clang compiler, there are some false-positive lifetimebound warnings and some implicit conversions can not be resolved. Thus, this refactoring commit also changed the affected places to replace Span with std::span.
This commit is contained in:
@@ -266,14 +266,14 @@ Span<std::byte> AsWritableBytes(Span<T> s) noexcept
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
Span<const std::byte> MakeByteSpan(V&& v) noexcept
|
||||
auto MakeByteSpan(const V& v) noexcept
|
||||
{
|
||||
return AsBytes(Span{std::forward<V>(v)});
|
||||
return std::as_bytes(std::span{v});
|
||||
}
|
||||
template <typename V>
|
||||
Span<std::byte> MakeWritableByteSpan(V&& v) noexcept
|
||||
auto MakeWritableByteSpan(V&& v) noexcept
|
||||
{
|
||||
return AsWritableBytes(Span{std::forward<V>(v)});
|
||||
return std::as_writable_bytes(std::span{std::forward<V>(v)});
|
||||
}
|
||||
|
||||
// Helper functions to safely cast basic byte pointers to unsigned char pointers.
|
||||
|
||||
Reference in New Issue
Block a user