File tree Expand file tree Collapse file tree 2 files changed +42
-2
lines changed
libs/core/compute_local/include/hpx/compute_local Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ namespace hpx::compute::detail {
5858 {
5959 }
6060
61+ public:
6162 HPX_HOST_DEVICE iterator (iterator const & other) noexcept
6263 : base_type(other)
6364 , target_(other.target_)
Original file line number Diff line number Diff line change @@ -240,8 +240,47 @@ namespace hpx::compute {
240240 return *(data_ + pos);
241241 }
242242
243- // TODO: implement front()
244- // TODO: implement back()
243+ // / Returns a reference to the first element in the container.
244+ // / Calling front on an empty container is undefined.
245+ HPX_HOST_DEVICE
246+ reference front ()
247+ {
248+ #if !defined(__CUDA_ARCH__)
249+ HPX_ASSERT (!empty ());
250+ #endif
251+ return *data_;
252+ }
253+
254+ // / \copydoc front()
255+ HPX_HOST_DEVICE
256+ const_reference front () const
257+ {
258+ #if !defined(__CUDA_ARCH__)
259+ HPX_ASSERT (!empty ());
260+ #endif
261+ return *data_;
262+ }
263+
264+ // / Returns a reference to the last element in the container.
265+ // / Calling back on an empty container is undefined.
266+ HPX_HOST_DEVICE
267+ reference back ()
268+ {
269+ #if !defined(__CUDA_ARCH__)
270+ HPX_ASSERT (!empty ());
271+ #endif
272+ return *(data_ + size_ - 1 );
273+ }
274+
275+ // / \copydoc back()
276+ HPX_HOST_DEVICE
277+ const_reference back () const
278+ {
279+ #if !defined(__CUDA_ARCH__)
280+ HPX_ASSERT (!empty ());
281+ #endif
282+ return *(data_ + size_ - 1 );
283+ }
245284
246285 // / Returns pointer to the underlying array serving as element storage.
247286 // / The pointer is such that range [data(); data() + size()) is always a
You can’t perform that action at this time.
0 commit comments