|
Stratax 0.4.0rc1
|
Non-owning view of elements with unsigned element strides. More...
#include <ArrayView.hpp>
Classes | |
| class | basic_iterator |
| Random-access iterator over logical flat indices of a view. More... | |
Public Types | |
| using | element_type = T |
| Element type including any const qualifier. | |
| using | value_type = std::remove_const_t< element_type > |
| Unqualified element type. | |
| using | size_type = std::size_t |
| Unsigned extent and offset type. | |
| using | difference_type = std::ptrdiff_t |
| Signed index and iterator-distance type. | |
| using | reference = element_type & |
| Element reference, mutable only when T is mutable. | |
| using | const_reference = const value_type & |
| Read-only element reference. | |
| using | pointer = element_type * |
| Element pointer with the constness of T. | |
| using | const_pointer = const value_type * |
| Read-only element pointer. | |
| using | const_view = ArrayView< const value_type > |
| View type exposing read-only elements. | |
| using | iterator = basic_iterator< false > |
| Mutable-view random-access iterator in logical order. | |
| using | const_iterator = basic_iterator< true > |
| Read-only random-access iterator in logical order. | |
Public Member Functions | |
| ArrayView (pointer data, const Shape &shape, const Shape &strides) | |
| Constructs a view after validating shape and stride metadata. | |
| template<typename U > requires ( std::is_const_v<element_type> && !std::is_const_v<U> && std::same_as<value_type, std::remove_const_t<U>> ) | |
| ArrayView (const ArrayView< U > &other) | |
| Creates a read-only alias of a mutable view, copying its metadata. | |
| const Shape & | shape () const noexcept |
| Logical extents. | |
| const Shape & | strides () const noexcept |
| Stored element strides. | |
| size_type | ndim () const noexcept |
| Alias for rank(). | |
| size_type | rank () const noexcept |
| Number of logical axes. | |
| size_type | size () const noexcept |
| Number of logical elements, zero for rank zero. | |
| bool | empty () const noexcept |
| Whether there are no logical elements. | |
| pointer | data () noexcept |
| Base storage pointer; empty views may have non-null pointers. | |
| const_pointer | data () const noexcept |
| Read-only base pointer; empty views may have non-null pointers. | |
| const_view | as_const () const |
| Read-only alias with copied metadata. | |
| reference | operator[] (size_type index) |
| Unchecked logical flat access. | |
| const_reference | operator[] (size_type index) const |
| Unchecked logical flat access. | |
| iterator | begin () noexcept |
| First logical-element iterator. | |
| const_iterator | begin () const noexcept |
| First logical-element iterator. | |
| const_iterator | cbegin () const noexcept |
| First logical-element iterator. | |
| iterator | end () noexcept |
| Past-the-end iterator. | |
| const_iterator | end () const noexcept |
| Past-the-end iterator. | |
| const_iterator | cend () const noexcept |
| Past-the-end iterator. | |
| template<typename... Rest> requires ((std::is_integral_v<Rest>) && ...) | |
| reference | operator() (size_type first, Rest... rest) |
| Accesses an element using multidimensional indices with rank checking only. | |
| template<typename... Rest> requires ((std::is_integral_v<Rest>) && ...) | |
| const_reference | operator() (size_type first, Rest... rest) const |
| Accesses an element using multidimensional indices with rank checking only. | |
| reference | at (difference_type index) |
| Checked logical flat access with negative indices. | |
| const_reference | at (difference_type index) const |
| Checked logical flat access with negative indices. | |
| reference | at (const std::vector< difference_type > &indices) |
| Checked multidimensional access with negative indices. | |
| const_reference | at (const std::vector< difference_type > &indices) const |
| Checked multidimensional access with negative indices. | |
Non-owning view of elements with unsigned element strides.
The view copies shape/stride metadata but never owns or extends the lifetime of the referenced storage. Copies alias the same elements. The caller must keep that allocation alive and large enough for every reachable offset. Strides may describe transposes, gaps, or repeated elements (zero strides); negative strides are not representable. Flat access follows logical row-major order, not necessarily physical storage order.
| T | Element type, optionally const; const elements prohibit writes. |
Definition at line 37 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::const_iterator = basic_iterator<true> |
Read-only random-access iterator in logical order.
Definition at line 169 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::const_pointer = const value_type* |
Read-only element pointer.
Definition at line 55 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::const_reference = const value_type& |
Read-only element reference.
Definition at line 51 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::const_view = ArrayView<const value_type> |
View type exposing read-only elements.
Definition at line 57 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::difference_type = std::ptrdiff_t |
Signed index and iterator-distance type.
Definition at line 47 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::element_type = T |
Element type including any const qualifier.
Definition at line 41 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::iterator = basic_iterator<false> |
Mutable-view random-access iterator in logical order.
Definition at line 167 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::pointer = element_type* |
Element pointer with the constness of T.
Definition at line 53 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::reference = element_type& |
Element reference, mutable only when T is mutable.
Definition at line 49 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::size_type = std::size_t |
Unsigned extent and offset type.
Definition at line 45 of file ArrayView.hpp.
| using stratax::core::ArrayView< T >::value_type = std::remove_const_t<element_type> |
Unqualified element type.
Definition at line 43 of file ArrayView.hpp.
|
inline |
Constructs a view after validating shape and stride metadata.
| data | Base address; may be null only for an empty view. |
| shape | Logical extents; rank zero describes an empty view. |
| strides | Non-negative strides measured in elements, one per axis. |
| Exceptions::RankError | If shape and stride ranks differ. |
| Exceptions::ValueError | If nonempty storage has a null pointer. |
| Exceptions::DimensionError | If the element count or maximum offset overflows. |
| std::bad_alloc | If metadata allocation fails. |
Definition at line 183 of file ArrayView.hpp.
|
inline |
Creates a read-only alias of a mutable view, copying its metadata.
| other | Source view; its allocation lifetime is still managed externally. |
| std::bad_alloc | If copying metadata fails. |
Definition at line 222 of file ArrayView.hpp.
|
inline |
Read-only alias with copied metadata.
| std::bad_alloc | If allocation fails. |
Definition at line 286 of file ArrayView.hpp.
|
inline |
Checked multidimensional access with negative indices.
| indices | One signed component per axis. |
| Exceptions::RankError | If the component count differs from rank(). |
| Exceptions::IndexError | If the view is empty or a component is out of bounds. |
Definition at line 397 of file ArrayView.hpp.
|
inline |
Checked multidimensional access with negative indices.
| indices | One signed component per axis. |
| Exceptions::RankError | If the component count differs from rank(). |
| Exceptions::IndexError | If the view is empty or a component is out of bounds. |
Definition at line 407 of file ArrayView.hpp.
|
inline |
Checked logical flat access with negative indices.
| index | Signed flat index; -1 selects the last logical element. |
| Exceptions::IndexError | If out of bounds, including every index of an empty view. |
Definition at line 376 of file ArrayView.hpp.
|
inline |
Checked logical flat access with negative indices.
| index | Signed flat index; -1 selects the last logical element. |
| Exceptions::IndexError | If out of bounds, including every index of an empty view. |
Definition at line 386 of file ArrayView.hpp.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Read-only base pointer; empty views may have non-null pointers.
Definition at line 279 of file ArrayView.hpp.
|
inlinenoexcept |
Base storage pointer; empty views may have non-null pointers.
Definition at line 272 of file ArrayView.hpp.
|
inlinenoexcept |
Whether there are no logical elements.
Definition at line 265 of file ArrayView.hpp.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Accesses an element using multidimensional indices with rank checking only.
| first | First non-negative axis index. |
| rest | Remaining non-negative axis indices. |
| Exceptions::RankError | If the number of components differs from rank(). |
Definition at line 326 of file ArrayView.hpp.
|
inline |
Accesses an element using multidimensional indices with rank checking only.
| first | First non-negative axis index. |
| rest | Remaining non-negative axis indices. |
| Exceptions::RankError | If the number of components differs from rank(). |
Definition at line 354 of file ArrayView.hpp.
|
inline |
Unchecked logical flat access.
Definition at line 292 of file ArrayView.hpp.
|
inline |
Unchecked logical flat access.
Definition at line 298 of file ArrayView.hpp.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Number of logical elements, zero for rank zero.
Definition at line 258 of file ArrayView.hpp.
|
inlinenoexcept |