userver: userver/utils/span.hpp File Reference
Loading...
Searching...
No Matches
span.hpp File Reference

Detailed Description

A polyfill for std::span with some of the newer features enabled.

Definition in file span.hpp.

Go to the source code of this file.

#include <concepts>
#include <cstddef>
#include <iterator>
#include <span>
#include <type_traits>
#include <userver/utils/assert.hpp>
+ This graph shows which files directly or indirectly include this file:

Classes

class  utils::span< T >
 A polyfill for std::span with some of the newer features enabled. More...
 

Namespaces

namespace  utils
 General-purpose utilities used across userver libraries.
 

Functions

template<typename It, typename EndOrSize>
 utils::span (It, EndOrSize) -> span< std::remove_reference_t< decltype(*std::declval< It & >())> >
 
template<typename R>
requires std::ranges::contiguous_range<R>
 utils::span (R &&) -> span< std::remove_reference_t< decltype(*std::begin(std::declval< R & >()))> >
 
template<typename T>
span< const std::byte > utils::as_bytes (span< T > s) noexcept
 Reinterprets the elements of a span as bytes.
 
template<typename T>
requires (!std::is_const_v<T>)
span< std::byte > utils::as_writable_bytes (span< T > s) noexcept
 Reinterprets the elements of a span as writable bytes.