Finite Volume Solver
prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
|
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 (pointer p, [[maybe_unused]] index_type size) |
Constructs a span from a pointer and size pair. More... | |
constexpr | span (pointer first, pointer last) |
Constructs a span from two pointers. More... | |
constexpr | span (element_type(&arr)[sextent]) noexcept |
Implicit conversion from a built-in C-style array. More... | |
template<typename ValueType , std::size_t Extent, typename = std::enable_if_t<Extent == extent>, typename = std::enable_if_t<std::is_convertible< const ValueType (*)[], element_type (*)[]>::value>> | |
constexpr | span (const std::array< ValueType, Extent > &arr) noexcept |
Implicit conversion from const std::array s. More... | |
template<typename ValueType , std::size_t Extent, typename = std::enable_if_t<Extent == extent>, typename = std::enable_if_t<std::is_convertible< ValueType (*)[], element_type (*)[]>::value>> | |
constexpr | span (std::array< ValueType, Extent > &arr) noexcept |
Implicit conversion from mutable std::array s. 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 , std::ptrdiff_t M> | |
constexpr | span (const span< S, M > &s) noexcept |
Implicit conversion from other span types. More... | |
template<typename S , typename = std::enable_if_t<std::is_convertible< typename span<S>::element_type (*)[], element_type (*)[]>::value>> | |
constexpr | span (const span< S > &s) |
Constructs a span from a pointer and size pair. More... | |
constexpr | span (const span &s) noexcept=default |
Defaulted copy constructor to trivially copy the class member variables. More... | |
Subviews [span.sub] | |
template<ptrdiff_t Count, typename = std::enable_if_t<(0 <= Count && Count <= extent)>> | |
constexpr span< element_type, Count > | first () const |
Returns a span of the first Count -many elements of this span. More... | |
constexpr span< element_type > | first (index_type count) const |
Returns a span of the first count -many elements of this span. More... | |
template<ptrdiff_t Count, typename = std::enable_if_t<(0 <= Count && Count <= extent)>> | |
constexpr span< element_type, Count > | last () const |
Returns a span of the last Count -many elements of this span. More... | |
constexpr span< element_type > | last (index_type count) const |
Returns a span of the last count -many elements of this span. More... | |
template<ptrdiff_t Offset, ptrdiff_t Count = dynamic_extent, typename = std::enable_if_t<(0 <= Offset && Offset <= extent)>, typename = std::enable_if_t<(Count == dynamic_extent || (0 <= Count && Count + Offset <= extent))>> | |
constexpr auto | subspan () const |
Returns a subspan viewing Count many elements from offset Offset . More... | |
constexpr span< element_type > | subspan (index_type offset, index_type count=dynamic_extent) const |
Returns a subspan viewing count many elements from offset offset . More... | |
Observers [span.obs] | |
constexpr index_type | size () const noexcept |
Returns the number of elements in the span. More... | |
constexpr index_type | 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... | |
constexpr reference | operator[] (index_type n) const |
Accesses the n-th element of the spanned array. More... | |
constexpr reference | operator() (index_type n) const |
Accesses the n-th element of the spanned array. More... | |
Static Public Attributes | |
static constexpr index_type | extent |
static constexpr std::size_t | sextent |
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... | |
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.
using fub::span< T, N >::const_iterator = std::add_const_t<T>* |
using fub::span< T, N >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
using fub::span< T, N >::difference_type = std::ptrdiff_t |
using fub::span< T, N >::element_type = T |
using fub::span< T, N >::index_type = std::ptrdiff_t |
using fub::span< T, N >::iterator = pointer |
using fub::span< T, N >::reverse_iterator = std::reverse_iterator<iterator> |
using fub::span< T, N >::value_type = std::remove_cv_t<T> |
|
inlineconstexpr |
Constructs a span from a pointer
and size
pair.
This performs an assertion check in debug builds which will terminate the application if the specified size does not match the extent.
[in] | p | a valid address pointing to the first element of the span. |
[in] | size | the size such that [p, p + size) is a valid range. |
size == extent
Nothing. |
|
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.
[in] | first | a valid address pointing to the first element of the span. |
[in] | last | a pointer such that [first, last) is a valid range. |
last - first == extent
Nothing. |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexpr |
Implicit conversion operator from a mutable container.
[in] | container | A container which owns the contiguous memory. The container must outlive this span, otherwise the span is dangling. |
Container | A container class which has the class member functions Container::data() and Container::size() . |
container.size() == extent
!is_span_v<Container>
Nothing. |
|
inlineconstexpr |
Implicit conversion operator from a constant container.
[in] | container | A container which owns the contiguous memory. The container must outlive this span, otherwise the span is dangling. |
Container | A container class which has the class member functions Container::data() and Container::size() . |
extent <= container.size()
!is_span_v<Container>
Nothing. |
|
inlineconstexpr |
Constructs a span from a pointer
and size
pair.
This performs an assertion check in debug builds which will terminate the application if the specified size does not match the extent.
[in] | p | a valid address pointing to the first element of the span. |
[in] | size | the size such that [p, p + size) is a valid range. |
size == extent
Nothing. |
|
constexprdefaultnoexcept |
Defaulted copy constructor to trivially copy the class member variables.
Nothing. |
|
inlineconstexprnoexcept |
Returns an iterator pointing to the first element of the span.
Nothing. |
|
inlineconstexprnoexcept |
Returns a const iterator pointing to the first element of the span.
Nothing. |
|
inlineconstexprnoexcept |
Returns a const iterator pointing one after the last element of the span.
Nothing. |
|
inlineconstexprnoexcept |
Returns a const reverse iterator pointing to the last element of the span.
Nothing. |
|
inlineconstexprnoexcept |
Returns a const reverse iterator pointing to the first element of the span.
Nothing. |
|
inlineconstexprnoexcept |
Returns the underlying pointer.
Nothing. |
|
inlineconstexprnoexcept |
Returns true if size() == 0
.
Nothing. |
|
inlineconstexprnoexcept |
Returns an iterator pointing one after the last element of the span.
Nothing. |
|
inlineconstexpr |
Returns a span of the first Count
-many elements of this span.
Count | Size of the returned subspan. |
0 <= Count && Count <= extent
.Nothing. |
|
inlineconstexpr |
Returns a span of the first count
-many elements of this span.
[in] | count | Size of the returned subspan. |
0 <= count && count <= extent
.Nothing. |
|
inlineconstexpr |
Returns a span of the last Count
-many elements of this span.
Count | Size of the returned subspan. |
0 <= Count && Count <= extent
.Nothing. |
|
inlineconstexpr |
Returns a span of the last count
-many elements of this span.
[in] | count | Size of the returned subspan. |
0 <= count && count <= extent
.Nothing. |
|
inlineconstexpr |
Accesses the n-th element of the spanned array.
Nothing. |
|
inlineconstexpr |
Accesses the n-th element of the spanned array.
Nothing. |
|
inlineconstexprnoexcept |
Returns a reverse iterator pointing to the last element of the span.
Nothing. |
|
inlineconstexprnoexcept |
Returns a reverse iterator pointing to the first element of the span.
Nothing. |
|
inlineconstexprnoexcept |
Returns the number of elements in the span.
Nothing. |
|
inlineconstexprnoexcept |
Returns the number of bytes which are spanned by this span.
Nothing. |
|
inlineconstexpr |
Returns a subspan viewing Count
many elements from offset Offset
.
Offset | the offset of the returned subspan. |
Count | Size of the returned subspan. |
0 <= Count && Count <= extent
.Nothing. |
|
inlineconstexpr |
Returns a subspan viewing count
many elements from offset offset
.
offset | the offset of the returned subspan. |
count | Size of the returned subspan. |
0 <= offset && offset <= extent
. count == dynamic_extent || 0 <= count && count + offset <= size()
.Nothing. |
|
staticconstexpr |
|
private |
Returns an iterator pointing to the first element of the span.
Nothing. |
|
staticconstexpr |