span Struct Reference#
|
Reference API
|
#include <ginkgo/core/base/range.hpp>
Public Member Functions | |
| constexpr | span (size_type point) noexcept |
| constexpr | span (size_type begin, size_type end) noexcept |
| constexpr bool | is_valid () const |
| constexpr size_type | length () const |
Public Attributes | |
| const size_type | begin |
| const size_type | end |
Detailed Description
A span is a lightweight structure used to create sub-ranges from other ranges.
A span s represents a contiguous set of indexes in one dimension of the range, starting on index s.begin (inclusive) and ending at index s.end (exclusive). A span is only valid if its starting index is smaller than its ending index.
Spans can be compared using the == and != operators. Two spans are identical if both their begin and end values are identical.
Spans also have two distinct partial orders defined on them:
x < y(y > x) if and only ifx.end < y.beginx <= y(y >= x) if and only ifx.end <= y.begin
Note that the orders are in fact partial - there are spans x and y for which none of the following inequalities holds: x < y, x > y, x == y, x <= y, x >= y. An example are spans span{0, 2} and span{1, 3}.
In addition, <= is a distinct order from <, and not just an extension of the strict order to its weak equivalent. Thus, x <= y is not equivalent to x < y || x == y.
Constructor & Destructor Documentation
◆ span() [1/2]
|
inlineconstexprnoexcept |
Creates a span representing a point point.
The begin of this span is set to point, and the end to point + 1.
- Parameters
-
point the point which the span represents
◆ span() [2/2]
Member Function Documentation
◆ is_valid()
|
inlineconstexpr |
Checks if a span is valid.
- Returns
- true if and only if
this->begin <= this->end
Referenced by gko::accessor::row_major< ValueType, Dimensionality >::operator()().
◆ length()
|
inlineconstexpr |
Member Data Documentation
◆ begin
| const size_type gko::span::begin |
Beginning of the span.
Referenced by is_valid(), length(), gko::accessor::row_major< ValueType, Dimensionality >::operator()(), and span().
◆ end
| const size_type gko::span::end |
End of the span.
Referenced by is_valid(), length(), and gko::accessor::row_major< ValueType, Dimensionality >::operator()().
The documentation for this struct was generated from the following file:
- ginkgo/core/base/range.hpp
Generated by