Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
Public Types | Static Public Attributes | List of all members
fub::span< T, 0 > Class Template Reference

A span is a view over a contiguous sequence of objects, the storage of which is owned by some other object. More...

#include <span.hpp>

Public Types

using element_type = T
 
using pointer = T *
 
using reference = T &
 
using value_type = std::remove_cv_t< T >
 
using index_type = std::ptrdiff_t
 
using difference_type = std::ptrdiff_t
 
using iterator = pointer
 
using const_iterator = std::add_const_t< T > *
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

Constructors, copy, and assignment [span.cons]
constexpr span () noexcept=default
 Constructs an empty span. More...
 
constexpr span (pointer p, [[maybe_unused]] index_type size)
 Constructs a span from a pointer + size pair. More...
 
constexpr span (pointer first, pointer last)
 Constructs a span from two pointers. More...
 
template<typename Container >
constexpr span (Container &container)
 Implicit conversion operator from a mutable container. More...
 
template<typename Container >
constexpr span (const Container &container)
 Implicit conversion operator from a constant container. More...
 
template<typename S >
constexpr span (const span< S, 0 > &s) noexcept
 Implicit conversion from other span types. More...
 
constexpr span (const span &s) noexcept=default
 Defaulted copy constructor to trivially copy the class member variables. More...
 
Observers [span.obs]
constexpr index_type size () const noexcept
 Returns the number of elements in the span. More...
 
constexpr std::ptrdiff_t size_bytes () const noexcept
 Returns the number of bytes which are spanned by this span. More...
 
constexpr bool empty () const noexcept
 Returns true if size() == 0. More...
 
Element access [span.elem]
constexpr pointer data () const noexcept
 Returns the underlying pointer. More...
 

Static Public Attributes

static constexpr index_type extent
 

Iterator support [span.iterators]

pointer pointer_
 Returns an iterator pointing to the first element of the span. More...
 
constexpr iterator begin () const noexcept
 Returns an iterator pointing to the first element of the span. More...
 
constexpr const_iterator cbegin () const noexcept
 Returns a const iterator pointing to the first element of the span. More...
 
constexpr iterator end () const noexcept
 Returns an iterator pointing one after the last element of the span. More...
 
constexpr const_iterator cend () const noexcept
 Returns a const iterator pointing one after the last element of the span. More...
 
constexpr reverse_iterator rbegin () const noexcept
 Returns a reverse iterator pointing to the last element of the span. More...
 
constexpr const_reverse_iterator crbegin () const noexcept
 Returns a const reverse iterator pointing to the last element of the span. More...
 
constexpr reverse_iterator rend () const noexcept
 Returns a reverse iterator pointing to the first element of the span. More...
 
constexpr const_reverse_iterator crend () const noexcept
 Returns a const reverse iterator pointing to the first element of the span. More...
 

Detailed Description

template<typename T>
class fub::span< T, 0 >

A span is a view over a contiguous sequence of objects, the storage of which is owned by some other object.

All member functions of span have constant time complexity.

T is required to be a complete object type that is not an abstract class type.

If N is negative and not equal to dynamic_­extent, the program is ill-formed.

Member Typedef Documentation

◆ const_iterator

template<typename T >
using fub::span< T, 0 >::const_iterator = std::add_const_t<T>*

◆ const_reverse_iterator

template<typename T >
using fub::span< T, 0 >::const_reverse_iterator = std::reverse_iterator<const_iterator>

◆ difference_type

template<typename T >
using fub::span< T, 0 >::difference_type = std::ptrdiff_t

◆ element_type

template<typename T >
using fub::span< T, 0 >::element_type = T

◆ index_type

template<typename T >
using fub::span< T, 0 >::index_type = std::ptrdiff_t

◆ iterator

template<typename T >
using fub::span< T, 0 >::iterator = pointer

◆ pointer

template<typename T >
using fub::span< T, 0 >::pointer = T*

◆ reference

template<typename T >
using fub::span< T, 0 >::reference = T&

◆ reverse_iterator

template<typename T >
using fub::span< T, 0 >::reverse_iterator = std::reverse_iterator<iterator>

◆ value_type

template<typename T >
using fub::span< T, 0 >::value_type = std::remove_cv_t<T>

Constructor & Destructor Documentation

◆ span() [1/7]

template<typename T >
constexpr fub::span< T, 0 >::span ( )
constexprdefaultnoexcept

Constructs an empty span.

Postcondition
data() == nullptr
size() == 0
Exceptions
Nothing.

◆ span() [2/7]

template<typename T >
constexpr fub::span< T, 0 >::span ( pointer  p,
[[maybe_unused] ] index_type  size 
)
inlineconstexpr

Constructs a span from a pointer + size pair.

This performs an assertion check in debug builds which will terminate the application if the specified size does not match the extent.

Precondition
p is a valid pointer.
size == 0
Postcondition
data() == p
size() == 0
Exceptions
Nothing.

◆ span() [3/7]

template<typename T >
constexpr fub::span< T, 0 >::span ( pointer  first,
pointer  last 
)
inlineconstexpr

Constructs a span from two pointers.

This performs an assertion check in debug builds which will terminate the application if the specified size does not match the extent.

Precondition
first and last are valid pointers.
first == last
Postcondition
data() == first
size() == last - first
Exceptions
Nothing.

◆ span() [4/7]

template<typename T >
template<typename Container >
constexpr fub::span< T, 0 >::span ( Container &  container)
inlineconstexpr

Implicit conversion operator from a mutable container.

Precondition
container.size() == extent
!is_span_v<Container>
container.size() == 0
Postcondition
data() == container.data()
size() == container.size()
Exceptions
Nothing.

◆ span() [5/7]

template<typename T >
template<typename Container >
constexpr fub::span< T, 0 >::span ( const Container &  container)
inlineconstexpr

Implicit conversion operator from a constant container.

Precondition
extent <= container.size()
!is_span_v<Container>
container.size() == 0
Postcondition
data() == container.data()
size() == container.size()
Exceptions
Nothing.

◆ span() [6/7]

template<typename T >
template<typename S >
constexpr fub::span< T, 0 >::span ( const span< S, 0 > &  s)
inlineconstexprnoexcept

Implicit conversion from other span types.

Precondition
std::is_convertible<S(*)[], T(*)[]>::value
Postcondition
data() == s.data()
Exceptions
Nothing.

◆ span() [7/7]

template<typename T >
constexpr fub::span< T, 0 >::span ( const span< T, 0 > &  s)
constexprdefaultnoexcept

Defaulted copy constructor to trivially copy the class member variables.

Exceptions
Nothing.

Member Function Documentation

◆ begin()

template<typename T >
constexpr iterator fub::span< T, 0 >::begin ( ) const
inlineconstexprnoexcept

Returns an iterator pointing to the first element of the span.

Exceptions
Nothing.

◆ cbegin()

template<typename T >
constexpr const_iterator fub::span< T, 0 >::cbegin ( ) const
inlineconstexprnoexcept

Returns a const iterator pointing to the first element of the span.

Exceptions
Nothing.

◆ cend()

template<typename T >
constexpr const_iterator fub::span< T, 0 >::cend ( ) const
inlineconstexprnoexcept

Returns a const iterator pointing one after the last element of the span.

Exceptions
Nothing.

◆ crbegin()

template<typename T >
constexpr const_reverse_iterator fub::span< T, 0 >::crbegin ( ) const
inlineconstexprnoexcept

Returns a const reverse iterator pointing to the last element of the span.

Exceptions
Nothing.

◆ crend()

template<typename T >
constexpr const_reverse_iterator fub::span< T, 0 >::crend ( ) const
inlineconstexprnoexcept

Returns a const reverse iterator pointing to the first element of the span.

Exceptions
Nothing.

◆ data()

template<typename T >
constexpr pointer fub::span< T, 0 >::data ( ) const
inlineconstexprnoexcept

Returns the underlying pointer.

Exceptions
Nothing.

◆ empty()

template<typename T >
constexpr bool fub::span< T, 0 >::empty ( ) const
inlineconstexprnoexcept

Returns true if size() == 0.

Exceptions
Nothing.

◆ end()

template<typename T >
constexpr iterator fub::span< T, 0 >::end ( ) const
inlineconstexprnoexcept

Returns an iterator pointing one after the last element of the span.

Exceptions
Nothing.

◆ rbegin()

template<typename T >
constexpr reverse_iterator fub::span< T, 0 >::rbegin ( ) const
inlineconstexprnoexcept

Returns a reverse iterator pointing to the last element of the span.

Exceptions
Nothing.

◆ rend()

template<typename T >
constexpr reverse_iterator fub::span< T, 0 >::rend ( ) const
inlineconstexprnoexcept

Returns a reverse iterator pointing to the first element of the span.

Exceptions
Nothing.

◆ size()

template<typename T >
constexpr index_type fub::span< T, 0 >::size ( ) const
inlineconstexprnoexcept

Returns the number of elements in the span.

Exceptions
Nothing.

◆ size_bytes()

template<typename T >
constexpr std::ptrdiff_t fub::span< T, 0 >::size_bytes ( ) const
inlineconstexprnoexcept

Returns the number of bytes which are spanned by this span.

Exceptions
Nothing.

Member Data Documentation

◆ extent

template<typename T >
constexpr index_type fub::span< T, 0 >::extent
staticconstexpr

◆ pointer_

template<typename T >
pointer fub::span< T, 0 >::pointer_
private

Returns an iterator pointing to the first element of the span.

Exceptions
Nothing.

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