muu/span.h file

Contains the definition of muu::span.

Namespaces

namespace muu
The root namespace for all muu functions and types.

Classes

template <typename T, size_t Extent = dynamic_extent, size_t Alignment = 0>
class muu::span
A non-owning view of contiguous elements.

Typedefs

template <size_t Alignment>
using aligned_byte_span = span<std::byte, dynamic_extent, Alignment>
Convenience alias for span<std::byte, dynamic_extent, Alignment>.
using byte_span = span<std::byte>
Convenience alias for span<std::byte>.
using const_byte_span = span<const std::byte>
Convenience alias for span<const std::byte>.
template <typename T, size_t Extent = dynamic_extent, size_t Alignment = 0>
using const_span = span<const T, Extent, Alignment>
Convenience alias for span<const T, Extent>.

Functions

template <typename T, size_t E, size_t A>
auto as_bytes(span<T, E, A> s) -> span<const std::byte, impl::as_bytes_extent<T, E>> noexcept
Reinterprets a span as an immutable view of the underlying bytes.
template <typename T, size_t E, size_t A>
auto as_writable_bytes(span<T, E, A> s) -> span<std::byte, impl::as_bytes_extent<T, E>> noexcept
Reinterprets a span as a view of the underlying bytes.

Variables

size_t dynamic_extent constexpr
Indicates the number of elements covered by a span should be dynamically-determined at runtime.