userver: utils::span< T > Class Template Reference
Loading...
Searching...
No Matches
utils::span< T > Class Template Referencefinal

#include <userver/utils/span.hpp>

Detailed Description

template<typename T>
class utils::span< T >

A polyfill for std::span from C++20.

Definition at line 30 of file span.hpp.

Public Types

using iterator = T*
 

Public Member Functions

constexpr span (T *begin, T *end) noexcept
 
constexpr span (T *begin, std::size_t size) noexcept
 
template<typename Container >
constexpr span (Container &&cont) noexcept
 
template<std::size_t Size>
constexpr span (impl::TypeIdentity< T >(&array)[Size]) noexcept
 
constexpr T * begin () const noexcept
 
constexpr T * end () const noexcept
 
constexpr T * data () const noexcept
 
constexpr std::size_t size () const noexcept
 
constexpr bool empty () const noexcept
 
constexpr span< T > first (std::size_t count) const noexcept
 
constexpr span< T > last (std::size_t count) const noexcept
 
constexpr span< T > subspan (std::size_t offset) const noexcept
 
constexpr span< T > subspan (std::size_t offset, std::size_t count) const noexcept
 
constexpr T & operator[] (std::size_t index) const noexcept
 

Member Typedef Documentation

◆ iterator

template<typename T >
using utils::span< T >::iterator = T*

Definition at line 32 of file span.hpp.

Constructor & Destructor Documentation

◆ span() [1/5]

template<typename T >
constexpr utils::span< T >::span ( )
inlineconstexprnoexcept

Definition at line 34 of file span.hpp.

◆ span() [2/5]

template<typename T >
constexpr utils::span< T >::span ( T * begin,
T * end )
inlineconstexprnoexcept

Definition at line 36 of file span.hpp.

◆ span() [3/5]

template<typename T >
constexpr utils::span< T >::span ( T * begin,
std::size_t size )
inlineconstexprnoexcept

Definition at line 41 of file span.hpp.

◆ span() [4/5]

template<typename T >
template<typename Container >
constexpr utils::span< T >::span ( Container && cont)
inlineconstexprnoexcept

Definition at line 58 of file span.hpp.

◆ span() [5/5]

template<typename T >
template<std::size_t Size>
constexpr utils::span< T >::span ( impl::TypeIdentity< T >(&) array[Size])
inlineconstexprnoexcept

Definition at line 62 of file span.hpp.

Member Function Documentation

◆ begin()

template<typename T >
constexpr T * utils::span< T >::begin ( ) const
inlineconstexprnoexcept

Definition at line 65 of file span.hpp.

◆ data()

template<typename T >
constexpr T * utils::span< T >::data ( ) const
inlineconstexprnoexcept

Definition at line 68 of file span.hpp.

◆ empty()

template<typename T >
constexpr bool utils::span< T >::empty ( ) const
inlineconstexprnoexcept

Definition at line 70 of file span.hpp.

◆ end()

template<typename T >
constexpr T * utils::span< T >::end ( ) const
inlineconstexprnoexcept

Definition at line 66 of file span.hpp.

◆ first()

template<typename T >
constexpr span< T > utils::span< T >::first ( std::size_t count) const
inlineconstexprnoexcept

Definition at line 72 of file span.hpp.

◆ last()

template<typename T >
constexpr span< T > utils::span< T >::last ( std::size_t count) const
inlineconstexprnoexcept

Definition at line 77 of file span.hpp.

◆ operator[]()

template<typename T >
constexpr T & utils::span< T >::operator[] ( std::size_t index) const
inlineconstexprnoexcept

Definition at line 93 of file span.hpp.

◆ size()

template<typename T >
constexpr std::size_t utils::span< T >::size ( ) const
inlineconstexprnoexcept

Definition at line 69 of file span.hpp.

◆ subspan() [1/2]

template<typename T >
constexpr span< T > utils::span< T >::subspan ( std::size_t offset) const
inlineconstexprnoexcept

Definition at line 82 of file span.hpp.

◆ subspan() [2/2]

template<typename T >
constexpr span< T > utils::span< T >::subspan ( std::size_t offset,
std::size_t count ) const
inlineconstexprnoexcept

Definition at line 87 of file span.hpp.


The documentation for this class was generated from the following file: