General Utility Library for C++17 25.4.1
Classes | Functions
gul17/span.h

Detailed Description

Backport of std::span from C++20.

Classes

class  gul17::span< ElementType, Extent >
 A view to a contiguous sequence of objects. More...
 

Functions

template<typename ElementType , std::size_t Extent>
span< const unsigned char,((Extent==dynamic_extent) ? dynamic_extent :sizeof(ElementType) *Extent)> gul17::as_bytes (span< ElementType, Extent > s) noexcept
 Return a constant view to the byte representation of the elements of a given span.
 
template<class ElementType , size_t Extent, typename std::enable_if<!std::is_const< ElementType >::value, int >::type = 0>
span< unsigned char,((Extent==dynamic_extent) ? dynamic_extent :sizeof(ElementType) *Extent)> gul17::as_writable_bytes (span< ElementType, Extent > s) noexcept
 Return a writable view to the byte representation of the elements of a given span.
 
template<std::size_t N, typename E , std::size_t S>
constexpr auto gul17::get (span< E, S > s) -> decltype(s[N])
 Return a reference to the Nth element of a given span.
 

Function Documentation

◆ as_bytes()

template<typename ElementType , std::size_t Extent>
span< const unsigned char,((Extent==dynamic_extent) ? dynamic_extent :sizeof(ElementType) *Extent)> gul17::as_bytes ( span< ElementType, Extent s)
noexcept

Return a constant view to the byte representation of the elements of a given span.

This is a backport from the C++20 standard library, see: https://en.cppreference.com/w/cpp/container/span/as_bytes

Since
GUL version 1.9

References gul17::bit_set().

◆ as_writable_bytes()

template<class ElementType , size_t Extent, typename std::enable_if<!std::is_const< ElementType >::value, int >::type = 0>
span< unsigned char,((Extent==dynamic_extent) ? dynamic_extent :sizeof(ElementType) *Extent)> gul17::as_writable_bytes ( span< ElementType, Extent s)
noexcept

Return a writable view to the byte representation of the elements of a given span.

This is a backport from the C++20 standard library, see: https://en.cppreference.com/w/cpp/container/span/as_bytes

Since
GUL version 1.9

References gul17::bit_set().

◆ get()

template<std::size_t N, typename E , std::size_t S>
constexpr auto gul17::get ( span< E, S s) -> decltype(s[N])
constexpr

Return a reference to the Nth element of a given span.

This is a backport from the C++20 standard library, see: https://en.cppreference.com/w/cpp/container/span/get

Since
GUL version 1.9

References gul17::bit_set().