22 Containers library [containers]

22.7 Views [views]

22.7.3 Class template span [views.span]

22.7.3.8 Views of object representation [span.objectrep]

template<class ElementType, size_t Extent> span<const byte, Extent == dynamic_extent ? dynamic_extent : sizeof(ElementType) * Extent> as_bytes(span<ElementType, Extent> s) noexcept;
Effects: Equivalent to: return R{reinterpret_­cast<const byte*>(s.data()), s.size_­bytes()}; where R is the return type.
template<class ElementType, size_t Extent> span<byte, Extent == dynamic_extent ? dynamic_extent : sizeof(ElementType) * Extent> as_writable_bytes(span<ElementType, Extent> s) noexcept;
Constraints: is_­const_­v<ElementType> is false.
Effects: Equivalent to: return R{reinterpret_­cast<byte*>(s.data()), s.size_­bytes()}; where R is the return type.