|
vecmem 1.22.0
|
A view for jagged vectors. More...
#include <vecmem/containers/data/jagged_vector_view.hpp>
Public Types | |
| using | size_type = std::size_t |
| We cannot use boolean types. | |
| using | value_type = vector_view< T > |
| Value type of the jagged array. | |
| using | pointer = std::add_pointer_t< value_type > |
| Pointer type to the jagged array. | |
Public Member Functions | |
| jagged_vector_view ()=default | |
| Default constructor. | |
| VECMEM_HOST_AND_DEVICE | jagged_vector_view (size_type size, pointer ptr, pointer host_ptr=nullptr) |
| Constructor with all the information held by the object. | |
| template<typename OTHERTYPE , std::enable_if_t< details::is_same_nc< T, OTHERTYPE >::value, bool > = true> | |
| VECMEM_HOST_AND_DEVICE | jagged_vector_view (const jagged_vector_view< OTHERTYPE > &parent) |
Constructor from a "slightly different" vecmem::details::jagged_vector_view object. | |
| template<typename OTHERTYPE , std::enable_if_t< details::is_same_nc< T, OTHERTYPE >::value, bool > = true> | |
| VECMEM_HOST_AND_DEVICE jagged_vector_view & | operator= (const jagged_vector_view< OTHERTYPE > &rhs) |
| Assignment operator from a "slightly different" object. | |
| template<typename OTHERTYPE , std::enable_if_t< std::is_same< std::remove_cv_t< T >, std::remove_cv_t< OTHERTYPE > >::value, bool > = true> | |
| VECMEM_HOST_AND_DEVICE bool | operator== (const jagged_vector_view< OTHERTYPE > &rhs) const |
| Equality check. | |
| template<typename OTHERTYPE , std::enable_if_t< std::is_same< std::remove_cv_t< T >, std::remove_cv_t< OTHERTYPE > >::value, bool > = true> | |
| VECMEM_HOST_AND_DEVICE bool | operator!= (const jagged_vector_view< OTHERTYPE > &rhs) const |
Inequality check. Simply based on operator==. | |
| VECMEM_HOST_AND_DEVICE size_type | size () const |
| Get the "outer" size of the jagged vector. | |
| VECMEM_HOST_AND_DEVICE size_type | capacity () const |
| Get the maximum capacity of the "outer" vector. | |
| VECMEM_HOST_AND_DEVICE pointer | ptr () const |
| Get a pointer to the vector elements. | |
| VECMEM_HOST_AND_DEVICE pointer | host_ptr () const |
| Access the host accessible array describing the inner vectors. | |
| template<typename OTHERTYPE , std::enable_if_t< details::is_same_nc< T, OTHERTYPE >::value, bool > > | |
| VECMEM_HOST_AND_DEVICE jagged_vector_view< T > & | operator= (const jagged_vector_view< OTHERTYPE > &rhs) |
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.
| using vecmem::data::jagged_vector_view< T >::size_type = std::size_t |
We cannot use boolean types.
Size type used in the class
| VECMEM_HOST_AND_DEVICE vecmem::data::jagged_vector_view< T >::jagged_vector_view | ( | const jagged_vector_view< OTHERTYPE > & | parent | ) |
Constructor from a "slightly different" vecmem::details::jagged_vector_view object.
Only enabled if the wrapped type is different, but only by const-ness. This complication is necessary to avoid problems from SYCL. Which is very particular about having default copy constructors for the types that it sends to kernels.
| VECMEM_HOST_AND_DEVICE auto vecmem::data::jagged_vector_view< T >::host_ptr | ( | ) | const |
Access the host accessible array describing the inner vectors.
This may or may not return the same pointer as ptr(). If the underlying data is stored in host-accessible memory, then the two will be the same.
If not, then ptr() will return the device accessible array, and this function returns a host-accessible one.
| VECMEM_HOST_AND_DEVICE bool vecmem::data::jagged_vector_view< T >::operator== | ( | const jagged_vector_view< OTHERTYPE > & | rhs | ) | const |
Equality check.
Two objects are only equal if they point at the same memory.