diff options
author | jeffro256 <jeffro256@tutanota.com> | 2023-06-22 09:15:12 +0200 |
---|---|---|
committer | jeffro256 <jeffro256@tutanota.com> | 2023-08-10 10:13:07 -0500 |
commit | 78348bcddd18fa7a25541595576bef1df4fc4022 (patch) | |
tree | 2013fb8202a2e5eb886c4a7a93c49bc7a177de09 /contrib | |
parent | Merge pull request #8917 (diff) | |
download | monero-78348bcddd18fa7a25541595576bef1df4fc4022.tar.xz |
wallet-rpc: restore from multisig seed
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/span.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/epee/include/span.h b/contrib/epee/include/span.h index 99c2ebb4f..23bd51f8c 100644 --- a/contrib/epee/include/span.h +++ b/contrib/epee/include/span.h @@ -147,6 +147,16 @@ namespace epee return {reinterpret_cast<const std::uint8_t*>(src.data()), src.size_bytes()}; } + //! \return `span<std::uint8_t>` from a STL compatible `src`. + template<typename T> + constexpr span<std::uint8_t> to_mut_byte_span(T& src) + { + using value_type = typename T::value_type; + static_assert(!std::is_empty<value_type>(), "empty value types will not work -> sizeof == 1"); + static_assert(!has_padding<value_type>(), "source value type may have padding"); + return {reinterpret_cast<std::uint8_t*>(src.data()), src.size() * sizeof(value_type)}; + } + //! \return `span<const std::uint8_t>` which represents the bytes at `&src`. template<typename T> span<const std::uint8_t> as_byte_span(const T& src) noexcept |