Backport
span.hpp File Reference

This header provides definitions from the C++ header More...

#include "detail/config.hpp"
#include "detail/proxy_iterator.hpp"
#include "cstddef.hpp"
#include "memory.hpp"
#include "type_traits.hpp"
#include <cstddef>
#include <array>
#include <iterator>
+ Include dependency graph for span.hpp:

Go to the source code of this file.

Classes

class  bpstd::span< T, Extent >
 This class is a non-owning view of a contiguous piece of memory. More...
 

Typedefs

template<typename It >
using bpstd::detail::iter_reference = typename std::iterator_traits< It >::reference
 
template<typename It , typename T >
using bpstd::detail::is_iter_convertible = conjunction< is_same< remove_cvref_t< iter_reference< It > >, remove_cv_t< T > >, is_convertible< iter_reference< It >, remove_cv_t< T > > >
 

Functions

template<typename T , std::size_t N>
span< const byte, sizeof(T) *N > bpstd::as_bytes (span< T, N > s) noexcept
 Converts a span s to a byte span. More...
 
template<typename T , std::size_t N>
span< byte, sizeof(T) *N > bpstd::as_writable_bytes (span< T, N > s) noexcept
 Converts a span s to a writable byte span. More...
 

Variables

constexpr BPSTD_CPP17_INLINE auto bpstd::dynamic_extent = static_cast<std::size_t>(-1)
 

Detailed Description

This header provides definitions from the C++ header

Definition in file span.hpp.

Function Documentation

◆ as_bytes()

template<typename T , std::size_t N>
span<const byte, sizeof(T) * N> bpstd::as_bytes ( span< T, N >  s)
noexcept

Converts a span s to a byte span.

Parameters
sthe span to convert
Returns
a span of the byte range that s covered

◆ as_writable_bytes()

template<typename T , std::size_t N>
span<byte, sizeof(T) * N> bpstd::as_writable_bytes ( span< T, N >  s)
noexcept

Converts a span s to a writable byte span.

Parameters
sthe span to convert
Returns
a span of the byte range that s covered