Non-owning view over contiguous storage, wrapping std::span. More...
#include <span.h>
Public Types | |
| using | Iterator = typename std::span< T >::iterator |
| Mutable forward iterator. | |
| using | ConstIterator = typename std::span< const T >::iterator |
| Const forward iterator. | |
| using | RevIterator = typename std::span< T >::reverse_iterator |
| Mutable reverse iterator. | |
| using | ConstRevIterator = typename std::span< const T >::reverse_iterator |
| Const reverse iterator. | |
Public Member Functions | |
| Span ()=default | |
| Default constructor. Creates an empty span. | |
| Span (T *ptr, size_t count) | |
| Constructs a span from a pointer and size. | |
| Span (List< T > &list) | |
| Constructs a span from a List. | |
| template<size_t N> | |
| Span (T(&arr)[N]) | |
| Constructs a span from a C array. | |
| template<size_t N> | |
| Span (Array< T, N > &arr) | |
| Constructs a span from an Array. | |
| Span (const Span &other)=default | |
| Copy constructor. | |
| Span & | operator= (const Span &other)=default |
| Copy assignment operator. | |
| Iterator | begin () noexcept |
| Returns a mutable iterator to the first element. | |
| ConstIterator | begin () const noexcept |
| Returns a const iterator to the first element. | |
| Iterator | end () noexcept |
| Returns a mutable iterator to one past the last element. | |
| ConstIterator | end () const noexcept |
| Returns a const iterator to one past the last element. | |
| ConstIterator | constBegin () const noexcept |
| Returns a const iterator to the first element. | |
| ConstIterator | constEnd () const noexcept |
| Returns a const iterator to one past the last element. | |
| RevIterator | rbegin () noexcept |
| Returns a mutable reverse iterator to the last element. | |
| RevIterator | revBegin () noexcept |
| Returns a mutable reverse iterator to the last element. | |
| RevIterator | rend () noexcept |
| Returns a mutable reverse iterator to one before the first element. | |
| RevIterator | revEnd () noexcept |
| Returns a mutable reverse iterator to one before the first element. | |
| ConstRevIterator | crbegin () const noexcept |
| Returns a const reverse iterator to the last element. | |
| ConstRevIterator | constRevBegin () const noexcept |
| Returns a const reverse iterator to the last element. | |
| ConstRevIterator | crend () const noexcept |
| Returns a const reverse iterator to one before the first element. | |
| ConstRevIterator | constRevEnd () const noexcept |
| Returns a const reverse iterator to one before the first element. | |
| T & | operator[] (size_t index) |
Returns a reference to the element at index without bounds checking. | |
| const T & | operator[] (size_t index) const |
Returns a reference to the element at index without bounds checking. | |
| T & | front () |
| Returns a reference to the first element. | |
| const T & | front () const |
| Returns a reference to the first element. | |
| T & | back () |
| Returns a reference to the last element. | |
| const T & | back () const |
| Returns a reference to the last element. | |
| T * | data () noexcept |
| Returns a pointer to the underlying contiguous storage. | |
| const T * | data () const noexcept |
| Returns a pointer to the underlying contiguous storage. | |
| bool | isEmpty () const noexcept |
| Returns true if the span has no elements. | |
| size_t | size () const noexcept |
| Returns the number of elements. | |
| size_t | sizeBytes () const noexcept |
| Returns the size in bytes. | |
| Span | subspan (size_t offset, size_t count) |
Returns a sub-span starting at offset with count elements. | |
| Span | first (size_t count) |
Returns a span of the first count elements. | |
| Span | last (size_t count) |
Returns a span of the last count elements. | |
| template<typename Func > | |
| void | forEach (Func &&func) const |
Calls func for every element. | |
Non-owning view over contiguous storage, wrapping std::span.
Provides a Qt-inspired API over std::span with consistent naming conventions matching the rest of libpromeki. Non-owning view — no PROMEKI_SHARED_FINAL.
| T | Element type. |
Constructs a span from a pointer and size.
| ptr | Pointer to the first element. |
| count | Number of elements. |
Constructs a span from a List.
| list | The list to view. |
Constructs a span from a C array.
| N | Array size. |
| arr | The C array to view. |
Returns a reference to the last element.
|
inlinenoexcept |
Returns a const reverse iterator to the last element.
|
inlinenoexcept |
Returns a const reverse iterator to one before the first element.
Returns a pointer to the underlying contiguous storage.
Returns a span of the first count elements.
| count | Number of elements. |
Calls func for every element.
| Func | Callable with signature void(const T &). |
| func | The function to invoke. |
Returns a reference to the first element.
Returns a span of the last count elements.
| count | Number of elements. |
Returns a reference to the element at index without bounds checking.
| index | Zero-based element index. |
Returns a reference to the element at index without bounds checking.
| index | Zero-based element index. |
|
inlinenoexcept |
Returns a mutable reverse iterator to the last element.
|
inlinenoexcept |
Returns a mutable reverse iterator to one before the first element.
Returns a sub-span starting at offset with count elements.
| offset | Starting element index. |
| count | Number of elements. |