ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
Utils::Span< T > Class Template Reference

A stripped-down version of std::span from C++17. More...

#include <Span.hpp>

Public Types

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

Public Member Functions

 Span ()=default
 
 Span (const Span &)=default
 
Spanoperator= (const Span &)=default
 
DEVICE_QUALIFIER constexpr Span (pointer array, size_type length)
 
template<std::size_t N>
DEVICE_QUALIFIER constexpr Span (T(&a)[N]) noexcept
 
template<typename C , typename = enable_if_mutable_t<C>, typename = enable_if_has_data_t<C>>
DEVICE_QUALIFIER Span (C &c) noexcept
 
template<typename C , typename = enable_if_const_t<C>, typename = enable_if_has_data_t<C>>
DEVICE_QUALIFIER Span (const C &c) noexcept
 
DEVICE_QUALIFIER constexpr size_type size () const
 
DEVICE_QUALIFIER constexpr bool empty () const
 
DEVICE_QUALIFIER constexpr iterator begin () const
 
DEVICE_QUALIFIER constexpr const_iterator cbegin () const
 
DEVICE_QUALIFIER constexpr iterator end () const
 
DEVICE_QUALIFIER constexpr const_iterator cend () const
 
constexpr reverse_iterator rbegin () const
 
constexpr reverse_iterator rend () const
 
DEVICE_QUALIFIER constexpr reference operator[] (size_type i) const
 
constexpr reference at (size_type i) const
 
DEVICE_QUALIFIER constexpr pointer data () const
 

Detailed Description

template<class T>
class Utils::Span< T >

A stripped-down version of std::span from C++17.

Behaves like a std::span where implemented.

Definition at line 38 of file Span.hpp.

Member Typedef Documentation

◆ const_iterator

template<class T >
using Utils::Span< T >::const_iterator = const_pointer

Definition at line 46 of file Span.hpp.

◆ const_pointer

template<class T >
using Utils::Span< T >::const_pointer = const T *

Definition at line 42 of file Span.hpp.

◆ const_reference

template<class T >
using Utils::Span< T >::const_reference = const T &

Definition at line 44 of file Span.hpp.

◆ const_reverse_iterator

template<class T >
using Utils::Span< T >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 48 of file Span.hpp.

◆ difference_type

template<class T >
using Utils::Span< T >::difference_type = std::ptrdiff_t

Definition at line 50 of file Span.hpp.

◆ iterator

template<class T >
using Utils::Span< T >::iterator = pointer

Definition at line 45 of file Span.hpp.

◆ pointer

template<class T >
using Utils::Span< T >::pointer = T *

Definition at line 41 of file Span.hpp.

◆ reference

template<class T >
using Utils::Span< T >::reference = T &

Definition at line 43 of file Span.hpp.

◆ reverse_iterator

template<class T >
using Utils::Span< T >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 47 of file Span.hpp.

◆ size_type

template<class T >
using Utils::Span< T >::size_type = std::size_t

Definition at line 49 of file Span.hpp.

◆ value_type

template<class T >
using Utils::Span< T >::value_type = typename std::remove_cv<T>::type

Definition at line 40 of file Span.hpp.

Constructor & Destructor Documentation

◆ Span() [1/6]

template<class T >
Utils::Span< T >::Span ( )
default

◆ Span() [2/6]

template<class T >
Utils::Span< T >::Span ( const Span< T > &  )
default

◆ Span() [3/6]

template<class T >
DEVICE_QUALIFIER constexpr Utils::Span< T >::Span ( pointer  array,
size_type  length 
)
inlineconstexpr

Definition at line 74 of file Span.hpp.

◆ Span() [4/6]

template<class T >
template<std::size_t N>
DEVICE_QUALIFIER constexpr Utils::Span< T >::Span ( T(&)  a[N])
inlineconstexprnoexcept

Definition at line 77 of file Span.hpp.

◆ Span() [5/6]

template<class T >
template<typename C , typename = enable_if_mutable_t<C>, typename = enable_if_has_data_t<C>>
DEVICE_QUALIFIER Utils::Span< T >::Span ( C &  c)
inlineexplicitnoexcept

Definition at line 81 of file Span.hpp.

◆ Span() [6/6]

template<class T >
template<typename C , typename = enable_if_const_t<C>, typename = enable_if_has_data_t<C>>
DEVICE_QUALIFIER Utils::Span< T >::Span ( const C &  c)
inlinenoexcept

Definition at line 84 of file Span.hpp.

Member Function Documentation

◆ at()

template<class T >
constexpr reference Utils::Span< T >::at ( size_type  i) const
inlineconstexpr

Definition at line 102 of file Span.hpp.

References Utils::Span< T >::size().

◆ begin()

template<class T >
DEVICE_QUALIFIER constexpr iterator Utils::Span< T >::begin ( ) const
inlineconstexpr

◆ cbegin()

template<class T >
DEVICE_QUALIFIER constexpr const_iterator Utils::Span< T >::cbegin ( ) const
inlineconstexpr

Definition at line 90 of file Span.hpp.

◆ cend()

template<class T >
DEVICE_QUALIFIER constexpr const_iterator Utils::Span< T >::cend ( ) const
inlineconstexpr

Definition at line 92 of file Span.hpp.

◆ data()

template<class T >
DEVICE_QUALIFIER constexpr pointer Utils::Span< T >::data ( ) const
inlineconstexpr

◆ empty()

template<class T >
DEVICE_QUALIFIER constexpr bool Utils::Span< T >::empty ( ) const
inlineconstexpr

◆ end()

template<class T >
DEVICE_QUALIFIER constexpr iterator Utils::Span< T >::end ( ) const
inlineconstexpr

◆ operator=()

template<class T >
Span & Utils::Span< T >::operator= ( const Span< T > &  )
default

◆ operator[]()

template<class T >
DEVICE_QUALIFIER constexpr reference Utils::Span< T >::operator[] ( size_type  i) const
inlineconstexpr

Definition at line 98 of file Span.hpp.

References DEVICE_ASSERT, and Utils::Span< T >::size().

◆ rbegin()

template<class T >
constexpr reverse_iterator Utils::Span< T >::rbegin ( ) const
inlineconstexpr

Definition at line 95 of file Span.hpp.

References Utils::Span< T >::end().

◆ rend()

template<class T >
constexpr reverse_iterator Utils::Span< T >::rend ( ) const
inlineconstexpr

Definition at line 96 of file Span.hpp.

References Utils::Span< T >::begin().

◆ size()


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