|
Stratax 0.2.0
|
Stores a rank-1 Stratax array in contiguous memory. More...
#include <Vector.hpp>
Public Types | |
| using | value_type = T |
| Element type stored by the vector. | |
| using | iterator = typename core::Buffer<T>::iterator |
| Mutable iterator over vector elements. | |
| using | const_iterator = typename core::Buffer<T>::const_iterator |
| Const iterator over vector elements. | |
| using | reverse_iterator = typename core::Buffer<T>::reverse_iterator |
| Mutable reverse iterator over vector elements. | |
| using | const_reverse_iterator = typename core::Buffer<T>::const_reverse_iterator |
| Const reverse iterator over vector elements. | |
| template<typename U> | |
| using | rebind = Vector<U> |
| Rebinds the vector container to another element type. | |
Public Member Functions | |
| Vector () noexcept=default | |
| Creates a default vector with no logical dimensions. | |
| Vector (std::size_t size) | |
| Creates a vector with the given number of elements. | |
| Vector (const core::Shape &shape) | |
| Creates a vector from a validated rank-1 shape. | |
| Vector (std::size_t size, const T &value) | |
| Creates a vector and fills it with a value. | |
| Vector (std::initializer_list< T > list) | |
| Creates a vector from an initializer list. | |
| Vector (const Vector &)=default | |
| Creates a copy of another vector. | |
| Vector (Vector &&) noexcept=default | |
| Transfers ownership from another vector. | |
| Vector & | operator= (const Vector &)=default |
| Replaces this vector with a copy of another vector. | |
| Vector & | operator= (Vector &&) noexcept=default |
| Replaces this vector by taking ownership from another vector. | |
| ~Vector ()=default | |
| Destroys the vector. | |
| T & | operator() (std::size_t index) noexcept |
| Returns a flat element without bounds checking. | |
| const T & | operator() (std::size_t index) const noexcept |
| Returns a flat element without bounds checking. | |
| T & | operator[] (std::size_t index) noexcept |
| Returns a flat element without bounds checking. | |
| const T & | operator[] (std::size_t index) const noexcept |
| Returns a flat element without bounds checking. | |
| T & | at (std::ptrdiff_t index) |
| Returns a flat element with bounds checking. | |
| const T & | at (std::ptrdiff_t index) const |
| Returns a flat element with bounds checking. | |
| T & | front () |
| Returns the first element. | |
| const T & | front () const |
| Returns the first element as a const reference. | |
| T & | back () |
| Returns the last element. | |
| const T & | back () const |
| Returns the last element as a const reference. | |
| std::size_t | size () const noexcept |
| Returns the number of stored elements. | |
| std::size_t | rank () const noexcept |
| Returns the vector rank. | |
| bool | empty () const noexcept |
| Returns whether the vector has no elements. | |
| const stratax::core::Shape & | shape () const noexcept |
| Returns the vector shape. | |
| const stratax::core::Strides & | strides () const noexcept |
| Returns the vector strides. | |
| T * | data () noexcept |
| Returns the raw data pointer. | |
| const T * | data () const noexcept |
| Returns the raw data pointer as a const pointer. | |
| iterator | begin () noexcept |
| Returns an iterator to the first element. | |
| const_iterator | begin () const noexcept |
| Returns a const iterator to the first element. | |
| const_iterator | cbegin () const noexcept |
| Returns a const iterator to the first element. | |
| iterator | end () noexcept |
| Returns an iterator one past the last element. | |
| const_iterator | end () const noexcept |
| Returns a const iterator one past the last element. | |
| const_iterator | cend () const noexcept |
| Returns a const iterator one past the last element. | |
| reverse_iterator | rbegin () noexcept |
| Returns a reverse iterator to the last element. | |
| const_reverse_iterator | rbegin () const noexcept |
| Returns a const reverse iterator to the last element. | |
| const_reverse_iterator | crbegin () const noexcept |
| Returns a const reverse iterator to the last element. | |
| reverse_iterator | rend () noexcept |
| Returns a reverse iterator before the first element. | |
| const_reverse_iterator | rend () const noexcept |
| Returns a const reverse iterator before the first element. | |
| const_reverse_iterator | crend () const noexcept |
| Returns a const reverse iterator before the first element. | |
| void | fill (const T &value) |
| Fills every element with the same value. | |
| void | swap (Vector &other) noexcept |
| Swaps the contents of two vectors. | |
Stores a rank-1 Stratax array in contiguous memory.
Vector owns its element storage and pairs it with shape and stride metadata so the container can participate in the generic array API.
| T | Numeric element type. |
Definition at line 26 of file Vector.hpp.
| using stratax::container::Vector< T >::const_iterator = typename core::Buffer<T>::const_iterator |
Const iterator over vector elements.
Definition at line 41 of file Vector.hpp.
| using stratax::container::Vector< T >::const_reverse_iterator = typename core::Buffer<T>::const_reverse_iterator |
Const reverse iterator over vector elements.
Definition at line 47 of file Vector.hpp.
| using stratax::container::Vector< T >::iterator = typename core::Buffer<T>::iterator |
Mutable iterator over vector elements.
Definition at line 38 of file Vector.hpp.
Rebinds the vector container to another element type.
Definition at line 51 of file Vector.hpp.
| using stratax::container::Vector< T >::reverse_iterator = typename core::Buffer<T>::reverse_iterator |
Mutable reverse iterator over vector elements.
Definition at line 44 of file Vector.hpp.
| using stratax::container::Vector< T >::value_type = T |
Element type stored by the vector.
Definition at line 35 of file Vector.hpp.
|
defaultnoexcept |
Creates a default vector with no logical dimensions.
The default vector has rank 0 and owns no element storage. Use Vector(0) when a rank-1 empty vector is required.
|
inlineexplicit |
Creates a vector with the given number of elements.
| size | Number of elements to allocate. |
Definition at line 68 of file Vector.hpp.
|
inlineexplicit |
Creates a vector from a validated rank-1 shape.
| shape | Source shape. |
| Exceptions::DimensionError | If the shape is not rank 1. |
Definition at line 82 of file Vector.hpp.
|
inline |
Creates a vector and fills it with a value.
| size | Number of elements to allocate. |
| value | Value to copy into each element. |
Definition at line 96 of file Vector.hpp.
|
inline |
Creates a vector from an initializer list.
| list | Source values in element order. |
Definition at line 109 of file Vector.hpp.
|
inline |
Returns a flat element with bounds checking.
| index | Flat element index. |
| Exceptions::IndexError | If the index is out of bounds. |
Definition at line 209 of file Vector.hpp.
|
inline |
Returns a flat element with bounds checking.
| index | Flat element index. |
| Exceptions::IndexError | If the index is out of bounds. |
Definition at line 225 of file Vector.hpp.
|
inline |
Returns the last element.
Definition at line 257 of file Vector.hpp.
|
inline |
Returns the last element as a const reference.
Definition at line 267 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator to the first element.
Definition at line 357 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns an iterator to the first element.
Definition at line 347 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator to the first element.
Definition at line 367 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator one past the last element.
Definition at line 397 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the last element.
Definition at line 427 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator before the first element.
Definition at line 457 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns the raw data pointer as a const pointer.
Definition at line 337 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns the raw data pointer.
Definition at line 327 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns whether the vector has no elements.
Definition at line 297 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator one past the last element.
Definition at line 387 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns an iterator one past the last element.
Definition at line 377 of file Vector.hpp.
|
inline |
Fills every element with the same value.
| value | Value to assign to each element. |
Definition at line 467 of file Vector.hpp.
|
inline |
Returns the first element.
Definition at line 237 of file Vector.hpp.
|
inline |
Returns the first element as a const reference.
Definition at line 247 of file Vector.hpp.
|
inlinenoexcept |
Returns a flat element without bounds checking.
| index | Flat element index. |
Definition at line 169 of file Vector.hpp.
|
inlinenoexcept |
Returns a flat element without bounds checking.
| index | Flat element index. |
Definition at line 156 of file Vector.hpp.
|
inlinenoexcept |
Returns a flat element without bounds checking.
| index | Flat element index. |
Definition at line 195 of file Vector.hpp.
|
inlinenoexcept |
Returns a flat element without bounds checking.
| index | Flat element index. |
Definition at line 182 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns the vector rank.
Definition at line 287 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the last element.
Definition at line 417 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a reverse iterator to the last element.
Definition at line 407 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator before the first element.
Definition at line 447 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns a reverse iterator before the first element.
Definition at line 437 of file Vector.hpp.
|
inlinenoexcept |
Returns the vector shape.
Definition at line 307 of file Vector.hpp.
|
inlinenodiscardnoexcept |
Returns the number of stored elements.
Definition at line 277 of file Vector.hpp.
|
inlinenoexcept |
Returns the vector strides.
Definition at line 317 of file Vector.hpp.
|
inlinenoexcept |
Swaps the contents of two vectors.
| other | Vector to exchange state with. |
Definition at line 477 of file Vector.hpp.