General Utility Library for C++14  2.7
Classes | Namespaces | Functions
span.h File Reference

Detailed Description

Provides a gul14::span that mimicks C++20's std::span as closely as possible.

Author
Tristan Brindle

Distributed under the Boost Software License, Version 1.0. (See Boost Software License - Version 1.0 or http://www.boost.org/LICENSE_1_0.txt)

For more information, see http://www.boost.org

This is an implementation of C++20's std::span http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/n4820.pdf

#include <array>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <stdexcept>
#include <type_traits>
Include dependency graph for span.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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

Namespaces

 gul14
 Namespace gul14 contains all functions and classes of the General Utility Library.
 

Functions

template<typename ElementType , std::size_t Extent>
span< const unsigned char,((Extent==dynamic_extent) ? dynamic_extent :sizeof(ElementType) *Extent)> gul14::as_bytes (span< ElementType, Extent > s) noexcept
 Return a constant view to the byte representation of the elements of a given span. More...
 
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)> gul14::as_writable_bytes (span< ElementType, Extent > s) noexcept
 Return a writable view to the byte representation of the elements of a given span. More...
 
template<std::size_t N, typename E , std::size_t S>
constexpr auto gul14::get (span< E, S > s) -> decltype(s[N])
 Return a reference to the Nth element of a given span. More...