Skip to content
24 changes: 24 additions & 0 deletions sycl/include/sycl/accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2529,6 +2529,12 @@ class __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor
// Use base classes constructors
using local_acc::local_acc;

using value_type = DataT;
using iterator = value_type *;
using const_iterator = const value_type *;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;

#ifdef __SYCL_DEVICE_ONLY__

// __init needs to be defined within the class not through inheritance.
Expand All @@ -2550,6 +2556,24 @@ class __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor
#endif

public:
iterator begin() const noexcept {
return &this->operator[](id<Dimensions>());
}
iterator end() const noexcept { return begin() + this->size(); }

const_iterator cbegin() const noexcept { return const_iterator(begin()); }
const_iterator cend() const noexcept { return const_iterator(end()); }

reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }

const_reverse_iterator crbegin() const noexcept {
return const_reverse_iterator(end());
}
const_reverse_iterator crend() const noexcept {
return const_reverse_iterator(begin());
}

template <typename Property> bool has_property() const noexcept {
#ifndef __SYCL_DEVICE_ONLY__
return this->getPropList().template has_property<Property>();
Expand Down