aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2023-08-17 10:20:20 -0500
committerluigi1111 <luigi1111w@gmail.com>2023-08-17 10:20:20 -0500
commit3b67d5fc5b8d91e4def0f7b3d63228caf1d29881 (patch)
tree7670a786eff91efcc05eceb22e7c01a1fcda67d7 /contrib/epee
parentMerge pull request #8913 (diff)
parentwallet-rpc: restore from multisig seed (diff)
downloadmonero-3b67d5fc5b8d91e4def0f7b3d63228caf1d29881.tar.xz
Merge pull request #8914
45b52de wallet-rpc: restore from multisig seed (jeffro256)
Diffstat (limited to 'contrib/epee')
-rw-r--r--contrib/epee/include/span.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/epee/include/span.h b/contrib/epee/include/span.h
index 82936a777..bbd5d690c 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