Span specialization that handle dynamic size. More...
#include <Span.h>
Public Types | |
typedef ElementType | element_type |
Type of the element contained. More... | |
typedef ptrdiff_t | index_type |
Type of the index. More... | |
typedef element_type * | pointer |
Pointer to an ElementType. More... | |
typedef element_type & | reference |
Reference to an ElementType. More... | |
Public Member Functions | |
Span () | |
Construct an empty Span. More... | |
Span (pointer ptr, index_type count) | |
Construct a Span from a pointer to a buffer and its size. More... | |
Span (pointer first, pointer last) | |
Construct a Span from the range [first, last). More... | |
template<size_t Count> | |
Span (element_type(&elements)[Count]) | |
Construct a Span from the reference to an array. More... | |
template<typename OtherElementType , ptrdiff_t OtherExtent> | |
Span (const Span< OtherElementType, OtherExtent > &other) | |
Construct a Span object from another Span. More... | |
index_type | size () const |
Return the size of the array viewed. More... | |
bool | empty () const |
Return if the sequence viewed is empty or not. More... | |
reference | operator[] (index_type index) const |
Access to an element of the sequence. More... | |
pointer | data () const |
Get the raw pointer to the sequence viewed. More... | |
template<ptrdiff_t Count> | |
Span< element_type, Count > | first () const |
Create a new Span over the first Count elements of the existing view. More... | |
template<ptrdiff_t Count> | |
Span< element_type, Count > | last () const |
Create a new Span over the last Count elements of the existing view. More... | |
template<std::ptrdiff_t Offset, std::ptrdiff_t Count> | |
Span< element_type, Count > | subspan () const |
Create a subspan that is a view other Count elements; the view starts at element Offset. More... | |
Span< element_type, SPAN_DYNAMIC_EXTENT > | first (index_type count) const |
Create a new Span over the first count elements of the existing view. More... | |
Span< element_type, SPAN_DYNAMIC_EXTENT > | last (index_type count) const |
Create a new Span over the last count elements of the existing view. More... | |
Span< element_type, SPAN_DYNAMIC_EXTENT > | subspan (index_type offset, index_type count=SPAN_DYNAMIC_EXTENT) const |
Create a subspan that is a view of other count elements; the view starts at element offset. More... | |
Static Public Attributes | |
static const index_type | extent = SPAN_DYNAMIC_EXTENT |
Size of the Extent; -1 if dynamic. More... | |
Span specialization that handle dynamic size.
typedef ElementType element_type |
typedef ptrdiff_t index_type |
typedef element_type* pointer |
typedef element_type& reference |
Span | ( | ) |
Span | ( | pointer | ptr, |
index_type | count | ||
) |
Construct a Span from a pointer to a buffer and its size.
ptr | Pointer to the beginning of the data viewed. |
count | Number of elements viewed. |
Construct a Span from the range [first, last).
first | Pointer to the beginning of the data viewed. |
last | End of the range (element after the last element). |
Span | ( | element_type(&) | elements[Count] | ) |
pointer data | ( | ) | const |
bool empty | ( | ) | const |
Span<element_type, Count> first | ( | ) | const |
Span<element_type, SPAN_DYNAMIC_EXTENT> first | ( | index_type | count | ) | const |
Span<element_type, Count> last | ( | ) | const |
Span<element_type, SPAN_DYNAMIC_EXTENT> last | ( | index_type | count | ) | const |
reference operator[] | ( | index_type | index | ) | const |
index_type size | ( | ) | const |
Span<element_type, Count> subspan | ( | ) | const |
Create a subspan that is a view other Count elements; the view starts at element Offset.
Offset | The offset of the first element viewed by the subspan. |
Count | The number of elements present in the subspan. If Count is equal to SPAN_DYNAMIC_EXTENT, then a Span starting at offset and containing the rest of the elements is returned. |
Span<element_type, SPAN_DYNAMIC_EXTENT> subspan | ( | index_type | offset, |
index_type | count = SPAN_DYNAMIC_EXTENT |
||
) | const |
Create a subspan that is a view of other count elements; the view starts at element offset.
offset | The offset of the first element viewed by the subspan. |
count | The number of elements present in the subspan. If Count is equal to SPAN_DYNAMIC_EXTENT, then a Span starting at offset and containing the rest of the elements is returned. |
|
static |