std::as_bytes, std::as_writable_bytes
提供: cppreference.com
<tbody>
</tbody>
template< class T, std::size_t N> std::span<const std::byte, S/* see below */> as_bytes(std::span<T, N> s) noexcept; |
(1) | |
template< class T, std::size_t N> std::span<std::byte, S/* see below */> as_writable_bytes(std::span<T, N> s) noexcept; |
(2) | |
スパン s の要素のオブジェクト表現に対するビューを取得します。
N が std::dynamic_extent の場合、返されるスパンのエクステント S も std::dynamic_extent です。 そうでなければ、 S は sizeof(T) * N です。
as_writable_bytes は、 std::is_const_v<T> が false の場合にのみ、オーバーロード解決に参加します。
戻り値
1)
{reinterpret_cast<const std::byte*>(s.data()), s.size_bytes()} で構築されたスパン。2)
{reinterpret_cast<std::byte*>(s.data()), s.size_bytes()} で構築されたスパン。