LibreOffice Module o3tl (master) 1
Public Types | Public Member Functions | Private Attributes | List of all members
o3tl::span< T > Class Template Reference

A barebones approximation of C++20 . More...

#include <span.hxx>

Inheritance diagram for o3tl::span< T >:
[legend]

Public Types

using value_type = T
 
using pointer = value_type *
 
using const_pointer = value_type const *
 
using reference = value_type &
 
using const_reference = value_type const &
 
using const_iterator = const_pointer
 
using iterator = pointer
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

constexpr span () noexcept
 
template<std::size_t N>
constexpr span (T(&a)[N]) noexcept
 
constexpr span (T *a, size_type len) noexcept
 
template<typename T2 >
constexpr span (const std::vector< T2 > &vec)
 
constexpr span (const span< typename std::remove_const< T >::type > &other) noexcept
 for assigning from span<T> to span<const T> More...
 
constexpr bool empty () const noexcept
 
constexpr iterator begin () const noexcept
 
constexpr iterator end () const noexcept
 
reverse_iterator rbegin () const noexcept
 
reverse_iterator rend () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr reference operator[] (size_type pos) const
 
constexpr pointer data () const noexcept
 

Private Attributes

pointer data_
 
size_type size_
 

Detailed Description

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

A barebones approximation of C++20 .

Definition at line 36 of file span.hxx.

Member Typedef Documentation

◆ const_iterator

template<typename T >
using o3tl::span< T >::const_iterator = const_pointer

Definition at line 43 of file span.hxx.

◆ const_pointer

template<typename T >
using o3tl::span< T >::const_pointer = value_type const *

Definition at line 40 of file span.hxx.

◆ const_reference

template<typename T >
using o3tl::span< T >::const_reference = value_type const &

Definition at line 42 of file span.hxx.

◆ const_reverse_iterator

template<typename T >
using o3tl::span< T >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 45 of file span.hxx.

◆ difference_type

template<typename T >
using o3tl::span< T >::difference_type = std::ptrdiff_t

Definition at line 48 of file span.hxx.

◆ iterator

template<typename T >
using o3tl::span< T >::iterator = pointer

Definition at line 44 of file span.hxx.

◆ pointer

template<typename T >
using o3tl::span< T >::pointer = value_type *

Definition at line 39 of file span.hxx.

◆ reference

template<typename T >
using o3tl::span< T >::reference = value_type &

Definition at line 41 of file span.hxx.

◆ reverse_iterator

template<typename T >
using o3tl::span< T >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 46 of file span.hxx.

◆ size_type

template<typename T >
using o3tl::span< T >::size_type = std::size_t

Definition at line 47 of file span.hxx.

◆ value_type

template<typename T >
using o3tl::span< T >::value_type = T

Definition at line 38 of file span.hxx.

Constructor & Destructor Documentation

◆ span() [1/5]

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

Definition at line 50 of file span.hxx.

◆ span() [2/5]

template<typename T >
template<std::size_t N>
constexpr o3tl::span< T >::span ( T(&)  a[N])
inlineconstexprnoexcept

Definition at line 53 of file span.hxx.

◆ span() [3/5]

template<typename T >
constexpr o3tl::span< T >::span ( T *  a,
size_type  len 
)
inlineconstexprnoexcept

Definition at line 55 of file span.hxx.

References a.

◆ span() [4/5]

template<typename T >
template<typename T2 >
constexpr o3tl::span< T >::span ( const std::vector< T2 > &  vec)
inlineconstexpr

Definition at line 63 of file span.hxx.

◆ span() [5/5]

template<typename T >
constexpr o3tl::span< T >::span ( const span< typename std::remove_const< T >::type > &  other)
inlineconstexprnoexcept

for assigning from span<T> to span<const T>

Definition at line 67 of file span.hxx.

Member Function Documentation

◆ begin()

template<typename T >
constexpr iterator o3tl::span< T >::begin ( ) const
inlineconstexprnoexcept

Definition at line 72 of file span.hxx.

References o3tl::span< T >::data_.

Referenced by o3tl::span< T >::end(), and o3tl::span< T >::rend().

◆ data()

template<typename T >
constexpr pointer o3tl::span< T >::data ( ) const
inlineconstexprnoexcept

Definition at line 87 of file span.hxx.

References o3tl::span< T >::data_.

◆ empty()

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

Definition at line 70 of file span.hxx.

References o3tl::span< T >::size_.

◆ end()

template<typename T >
constexpr iterator o3tl::span< T >::end ( ) const
inlineconstexprnoexcept

Definition at line 73 of file span.hxx.

References o3tl::span< T >::begin(), and o3tl::span< T >::size().

Referenced by o3tl::span< T >::rbegin().

◆ operator[]()

template<typename T >
constexpr reference o3tl::span< T >::operator[] ( size_type  pos) const
inlineconstexpr

Definition at line 82 of file span.hxx.

References o3tl::span< T >::data_, pos, and o3tl::span< T >::size().

◆ rbegin()

template<typename T >
reverse_iterator o3tl::span< T >::rbegin ( ) const
inlinenoexcept

Definition at line 75 of file span.hxx.

References o3tl::span< T >::end().

◆ rend()

template<typename T >
reverse_iterator o3tl::span< T >::rend ( ) const
inlinenoexcept

Definition at line 77 of file span.hxx.

References o3tl::span< T >::begin().

◆ size()

template<typename T >
constexpr size_type o3tl::span< T >::size ( ) const
inlineconstexprnoexcept

Definition at line 80 of file span.hxx.

References o3tl::span< T >::size_.

Referenced by o3tl::span< T >::end(), and o3tl::span< T >::operator[]().

Member Data Documentation

◆ data_

template<typename T >
pointer o3tl::span< T >::data_
private

◆ size_

template<typename T >
size_type o3tl::span< T >::size_
private

Definition at line 91 of file span.hxx.

Referenced by o3tl::span< T >::empty(), and o3tl::span< T >::size().


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