Generic class for row-major 2D spans. Not compliant with STL container semantics/syntax. More...
#include <span.hpp>
Public Types | |
using | size_type = std::pair< size_t, size_t > |
Type used to represent the dimension of the span. | |
Public Member Functions | |
constexpr | base_2dspan (T *data, size_t rows, size_t columns) noexcept |
Constructor a 2D span. More... | |
base_2dspan (T *data, size_type size) noexcept | |
Constructor a 2D span. More... | |
constexpr auto | data () const noexcept |
Returns a pointer to the beginning of the sequence. More... | |
constexpr auto | size () const noexcept |
Returns the size in the span as pair. More... | |
constexpr auto | count () const noexcept |
Returns the number of elements in the span. More... | |
constexpr bool | is_empty () const noexcept |
Checks if the span is empty. More... | |
constexpr RowType< T, dynamic_extent > | operator[] (size_t row) const |
Returns a reference to the row-th element of the sequence. More... | |
constexpr RowType< T, dynamic_extent > | front () const |
Returns a reference to the first element in the span. More... | |
constexpr RowType< T, dynamic_extent > | back () const |
Returns a reference to the last element in the span. More... | |
constexpr base_2dspan | subspan (size_t first_row, size_t num_rows) const noexcept |
Obtains a 2D span that is a view over the num_rows rows of this span starting at first_row More... | |
constexpr RowType< T, dynamic_extent > | flat_view () |
Returns a flattened span of the 2D span. More... | |
template<typename OtherT , template< typename, size_t > typename OtherRowType, std::enable_if_t< std::is_convertible_v< OtherRowType< OtherT, dynamic_extent >, RowType< T, dynamic_extent >>, void > * = nullptr> | |
constexpr | base_2dspan (base_2dspan< OtherT, OtherRowType > const &other) noexcept |
Construct a 2D span from another 2D span of convertible type. More... | |
Static Public Member Functions | |
static constexpr size_t | flatten_index (size_t row, size_t column, size_type size) noexcept |
Returns flattened index of the element at the specified 2D position. More... | |
Protected Attributes | |
T * | _data = nullptr |
pointer to the first element | |
size_type | _size {0, 0} |
rows, columns | |
Generic class for row-major 2D spans. Not compliant with STL container semantics/syntax.
The index operator returns the corresponding row.
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexpr |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexpr |
|
inlinestaticconstexprnoexcept |
|
inlineconstexpr |
|
inlineconstexprnoexcept |
|
inlineconstexpr |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Obtains a 2D span that is a view over the num_rows
rows of this span starting at first_row
first_row | The first row in the subspan |
num_rows | The number of rows in the subspan |
first_row
and num_rows