vecmem 1.14.0
|
A view for jagged vectors. More...
#include <vecmem/containers/jagged_device_vector.hpp>
Public Types | |
Type definitions, mimicking @c std::vector | |
using | value_type = device_vector< T > |
Type of the "outer" array elements. | |
using | size_type = std::size_t |
Size type for the array. | |
using | difference_type = std::ptrdiff_t |
Pointer difference type. | |
using | reference = device_vector< T > |
Value reference type. | |
using | const_reference = device_vector< std::add_const_t< T > > |
Constant value reference type. | |
using | iterator = details::jagged_device_vector_iterator< T > |
Forward iterator type. | |
using | const_iterator = details::jagged_device_vector_iterator< std::add_const_t< T > > |
Constant forward iterator type. | |
using | reverse_iterator = details::reverse_iterator< iterator > |
Reverse iterator type. | |
using | const_reverse_iterator = details::reverse_iterator< const_iterator > |
Constant reverse iterator type. | |
Public Member Functions | |
VECMEM_HOST_AND_DEVICE | jagged_device_vector (data::jagged_vector_view< T > data) |
Construct a jagged device vector from a jagged vector view object. | |
VECMEM_HOST_AND_DEVICE | jagged_device_vector (const jagged_device_vector &parent) |
Copy constructor. | |
VECMEM_HOST_AND_DEVICE jagged_device_vector & | operator= (const jagged_device_vector &rhs) |
Copy assignment operator. | |
Vector element access functions | |
VECMEM_HOST_AND_DEVICE reference | at (size_type pos) |
Return a specific element of the vector in a "safe way" (non-const) | |
VECMEM_HOST_AND_DEVICE const_reference | at (size_type pos) const |
Return a specific element of the vector in a "safe way" (const) | |
VECMEM_HOST_AND_DEVICE reference | operator[] (size_type pos) |
Return a specific element of the vector (non-const) | |
VECMEM_HOST_AND_DEVICE const_reference | operator[] (size_type pos) const |
Return a specific element of the vector (const) | |
VECMEM_HOST_AND_DEVICE reference | front () |
Return the first element of the vector (non-const) | |
VECMEM_HOST_AND_DEVICE const_reference | front () const |
Return the first element of the vector (const) | |
VECMEM_HOST_AND_DEVICE reference | back () |
Return the last element of the vector (non-const) | |
VECMEM_HOST_AND_DEVICE const_reference | back () const |
Return the last element of the vector (const) | |
Iterator providing functions | |
VECMEM_HOST_AND_DEVICE iterator | begin () |
Return a forward iterator pointing at the beginning of the vector. | |
VECMEM_HOST_AND_DEVICE const_iterator | begin () const |
Return a constant forward iterator pointing at the beginning of the vector. | |
VECMEM_HOST_AND_DEVICE const_iterator | cbegin () const |
Return a constant forward iterator pointing at the beginning of the vector. | |
VECMEM_HOST_AND_DEVICE iterator | end () |
Return a forward iterator pointing at the end of the vector. | |
VECMEM_HOST_AND_DEVICE const_iterator | end () const |
Return a constant forward iterator pointing at the end of the vector. | |
VECMEM_HOST_AND_DEVICE const_iterator | cend () const |
Return a constant forward iterator pointing at the end of the vector. | |
VECMEM_HOST_AND_DEVICE reverse_iterator | rbegin () |
Return a reverse iterator pointing at the end of the vector. | |
VECMEM_HOST_AND_DEVICE const_reverse_iterator | rbegin () const |
Return a constant reverse iterator pointing at the end of the vector. | |
VECMEM_HOST_AND_DEVICE const_reverse_iterator | crbegin () const |
Return a constant reverse iterator pointing at the end of the vector. | |
VECMEM_HOST_AND_DEVICE reverse_iterator | rend () |
Return a reverse iterator pointing at the beginning of the vector. | |
VECMEM_HOST_AND_DEVICE const_reverse_iterator | rend () const |
Return a constant reverse iterator pointing at the beginning of the vector. | |
VECMEM_HOST_AND_DEVICE const_reverse_iterator | crend () const |
Return a constant reverse iterator pointing at the beginning of the vector. | |
Capacity checking functions | |
VECMEM_HOST_AND_DEVICE bool | empty (void) const |
Checks whether this view has no rows. | |
VECMEM_HOST_AND_DEVICE size_type | size (void) const |
Get the number of rows in this view. | |
VECMEM_HOST_AND_DEVICE size_type | max_size () const |
Return the maximum (fixed) number of elements in the vector. | |
VECMEM_HOST_AND_DEVICE size_type | capacity () const |
Return the current (fixed) capacity of the vector. | |
A view for jagged vectors.
A jagged vector is a two-dimensional vector in which the inner vectors do not necessarily have the same size. For example, a jagged vector might look like this:
[[0, 1, 2], [3, 4], [], [5, 6, 7]]
This class is a view of existing two-dimensional vectors created using a vector-of-vectors formalism. Elements cannot be added or removed through this view, but individual elements can be accessed and modified.
VECMEM_HOST_AND_DEVICE bool vecmem::jagged_device_vector< T >::empty | ( | void | ) | const |
Checks whether this view has no rows.
Returns true if the jagged vector is empty, and false otherwise.