Span Flashcards
Iterators
begin( )
returns an iterator to the beginning
Parameters
(none)
Return value
Iterator to the first element.
Complexity
Constant.
Iterators
end( )
returns an iterator to the end
Parameters
(none)
Return value
Iterator to the element following the last element.
Complexity
Constant.
Iterators
rbegin( )
returns a reverse iterator to the beginning
Parameters
(none)
Return value
Reverse iterator to the first element.
Complexity
Constant.
Iterators
rend( )
returns a reverse iterator to the end
Parameters
(none)
Return value
Reverse iterator to the element following the last element.
Complexity
Constant.
Element access
front( )
access the first element
Parameters
(none)
Return value
A reference to the first element.
Complexity
Constant
Element access
back( )
access the last element
Parameters
(none)
Return value
A reference to the back element.
Complexity
Constant
Element access
operator[]
accesses an element of the sequence Parameters idx - the index of the element to access Return value A reference to the idx-th element of the sequence, i.e., data()[idx]
Exceptions
Throws nothing.
Element access
data( )
returns a pointer to the beginning of the sequence of elements
Return value
A pointer to the beginning of the sequence.
Observers
size( )
returns the number of elements in the sequence
Return value
The number of elements in the span.
Observers
size_bytes( )
returns the size of the sequence
Return value
The size of the sequence in bytes, i.e., size() * sizeof(element_type). in bytes
Observers
empty( )
checks if the sequence is empty
Return value
true if the span is empty (i.e., size() == 0); false otherwise.
Subviews
first( )
obtains a subspan consisting of the first N elements of the sequence
Return value
A span r that is a view over the first Count elements of *this, such that r.data() == this->data() && r.size() == Count.
Subviews
last( )
obtains a subspan consisting of the last N elements of the sequence
Return value
A span r that is a view over the last Count elements of *this, such that r.data() == this->data() + (this->size() - Count) && r.size() == Count.
Subviews
subspan( )
obtains a subspan
Return value
The requested subspan r, such that r.data() == this->data() + Offset. If Count is std::dynamic_extent, r.size() == this->size() - Offset; otherwise r.size() == Count.