vecmem 1.14.0
Loading...
Searching...
No Matches
jagged_device_vector.hpp
1/*
2 * VecMem project, part of the ACTS project (R&D line)
3 *
4 * (c) 2021-2025 CERN for the benefit of the ACTS project
5 *
6 * Mozilla Public License Version 2.0
7 */
8
9#pragma once
10
11// Local include(s).
12#include "vecmem/containers/data/jagged_vector_view.hpp"
13#include "vecmem/containers/details/jagged_device_vector_iterator.hpp"
14#include "vecmem/containers/details/reverse_iterator.hpp"
15#include "vecmem/containers/device_vector.hpp"
16#include "vecmem/utils/type_traits.hpp"
17#include "vecmem/utils/types.hpp"
18
19// System include(s).
20#include <cstddef>
21#include <type_traits>
22
23namespace vecmem {
24
46template <typename T>
48
49public:
52
56 using size_type = std::size_t;
58 using difference_type = std::ptrdiff_t;
59
64
74
76
81 VECMEM_HOST_AND_DEVICE
83
85 VECMEM_HOST_AND_DEVICE
87
89 VECMEM_HOST_AND_DEVICE
91
94
96 VECMEM_HOST_AND_DEVICE
99 VECMEM_HOST_AND_DEVICE
101
103 VECMEM_HOST_AND_DEVICE
106 VECMEM_HOST_AND_DEVICE
108
110 VECMEM_HOST_AND_DEVICE
113 VECMEM_HOST_AND_DEVICE
114 const_reference front() const;
115
117 VECMEM_HOST_AND_DEVICE
118 reference back();
120 VECMEM_HOST_AND_DEVICE
121 const_reference back() const;
122
124
127
129 VECMEM_HOST_AND_DEVICE
130 iterator begin();
133 VECMEM_HOST_AND_DEVICE
134 const_iterator begin() const;
137 VECMEM_HOST_AND_DEVICE
138 const_iterator cbegin() const;
139
141 VECMEM_HOST_AND_DEVICE
142 iterator end();
144 VECMEM_HOST_AND_DEVICE
145 const_iterator end() const;
147 VECMEM_HOST_AND_DEVICE
148 const_iterator cend() const;
149
151 VECMEM_HOST_AND_DEVICE
154 VECMEM_HOST_AND_DEVICE
157 VECMEM_HOST_AND_DEVICE
159
161 VECMEM_HOST_AND_DEVICE
165 VECMEM_HOST_AND_DEVICE
169 VECMEM_HOST_AND_DEVICE
171
173
176
185 VECMEM_HOST_AND_DEVICE
186 bool empty(void) const;
187
191 VECMEM_HOST_AND_DEVICE
192 size_type size(void) const;
193
195 VECMEM_HOST_AND_DEVICE
196 size_type max_size() const;
198 VECMEM_HOST_AND_DEVICE
199 size_type capacity() const;
200
202
203private:
207 size_type m_size;
208
213
214}; // class jagged_device_vector
215
216} // namespace vecmem
217
218// Include the implementation.
219#include "vecmem/containers/impl/jagged_device_vector.ipp"
A view for jagged vectors.
Definition jagged_vector_view.hpp:44
std::add_pointer_t< value_type > pointer
Pointer type to the jagged array.
Definition jagged_vector_view.hpp:56
Custom iterator for vecmem::jagged_device_vector.
Definition jagged_device_vector_iterator.hpp:34
Type mimicking std::reverse_iterator.
Definition reverse_iterator.hpp:25
A view for jagged vectors.
Definition jagged_device_vector.hpp:47
VECMEM_HOST_AND_DEVICE reverse_iterator rend()
Return a reverse iterator pointing at the beginning of the vector.
Definition jagged_device_vector.ipp:186
VECMEM_HOST_AND_DEVICE const_iterator cbegin() const
Return a constant forward iterator pointing at the beginning of the vector.
Definition jagged_device_vector.ipp:138
VECMEM_HOST_AND_DEVICE jagged_device_vector & operator=(const jagged_device_vector &rhs)
Copy assignment operator.
Definition jagged_device_vector.ipp:28
VECMEM_HOST_AND_DEVICE const_iterator cend() const
Return a constant forward iterator pointing at the end of the vector.
Definition jagged_device_vector.ipp:158
VECMEM_HOST_AND_DEVICE size_type max_size() const
Return the maximum (fixed) number of elements in the vector.
Definition jagged_device_vector.ipp:218
std::ptrdiff_t difference_type
Pointer difference type.
Definition jagged_device_vector.hpp:58
VECMEM_HOST_AND_DEVICE reference at(size_type pos)
Return a specific element of the vector in a "safe way" (non-const)
Definition jagged_device_vector.ipp:45
VECMEM_HOST_AND_DEVICE reverse_iterator rbegin()
Return a reverse iterator pointing at the end of the vector.
Definition jagged_device_vector.ipp:165
VECMEM_HOST_AND_DEVICE const_reverse_iterator crend() const
Return a constant reverse iterator pointing at the beginning of the vector.
Definition jagged_device_vector.ipp:200
VECMEM_HOST_AND_DEVICE reference front()
Return the first element of the vector (non-const)
Definition jagged_device_vector.ipp:83
VECMEM_HOST_AND_DEVICE size_type size(void) const
Get the number of rows in this view.
Definition jagged_device_vector.ipp:212
VECMEM_HOST_AND_DEVICE iterator begin()
Return a forward iterator pointing at the beginning of the vector.
Definition jagged_device_vector.ipp:125
VECMEM_HOST_AND_DEVICE const_reverse_iterator crbegin() const
Return a constant reverse iterator pointing at the end of the vector.
Definition jagged_device_vector.ipp:179
device_vector< T > reference
Value reference type.
Definition jagged_device_vector.hpp:61
VECMEM_HOST_AND_DEVICE reference back()
Return the last element of the vector (non-const)
Definition jagged_device_vector.ipp:104
device_vector< T > value_type
Type of the "outer" array elements.
Definition jagged_device_vector.hpp:54
VECMEM_HOST_AND_DEVICE iterator end()
Return a forward iterator pointing at the end of the vector.
Definition jagged_device_vector.ipp:145
device_vector< std::add_const_t< T > > const_reference
Constant value reference type.
Definition jagged_device_vector.hpp:63
VECMEM_HOST_AND_DEVICE bool empty(void) const
Checks whether this view has no rows.
Definition jagged_device_vector.ipp:207
VECMEM_HOST_AND_DEVICE size_type capacity() const
Return the current (fixed) capacity of the vector.
Definition jagged_device_vector.ipp:225
VECMEM_HOST_AND_DEVICE reference operator[](size_type pos)
Return a specific element of the vector (non-const)
Definition jagged_device_vector.ipp:67
std::size_t size_type
Size type for the array.
Definition jagged_device_vector.hpp:56
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16
std::vector< T, vecmem::polymorphic_allocator< T > > vector
Alias type for vectors with our polymorphic allocator.
Definition vector.hpp:35