14template<
typename T>
class BufferRangeIterator;
38 : start_(buffer + start_elem_index * elem_stride), size_(size), elem_stride_(elem_stride)
44 return a.start_ ==
b.start_ && a.size_ ==
b.size_ && a.elem_stride_ ==
b.elem_stride_;
54 return start_ + index * elem_stride_;
67 return begin_iterator<Iterator>();
72 return end_iterator<Iterator>();
77 return begin_iterator<ConstIterator>();
82 return end_iterator<ConstIterator>();
86 template<
typename TIterator>
constexpr TIterator begin_iterator()
const
88 if (elem_stride_ == 0) {
90 return TIterator(start_, 1);
93 return TIterator(start_, elem_stride_);
96 template<
typename TIterator>
constexpr TIterator end_iterator()
const
98 if (elem_stride_ == 0) {
100 return TIterator(start_ + 1, 1);
103 return TIterator(start_ + size_ * elem_stride_, elem_stride_);
123 : current_(current), elem_stride_(elem_stride)
129 current_ += elem_stride_;
137 return copied_iterator;
142 return a.current_ !=
b.current_;
147 return a.current_ ==
b.current_;
std::input_iterator_tag iterator_category
constexpr BufferRangeIterator(T *current, int elem_stride=1)
constexpr T * operator*() const
constexpr BufferRangeIterator()=default
constexpr BufferRangeIterator & operator++()
constexpr friend bool operator==(const BufferRangeIterator &a, const BufferRangeIterator &b)
constexpr friend bool operator!=(const BufferRangeIterator &a, const BufferRangeIterator &b)
std::ptrdiff_t difference_type
constexpr BufferRangeIterator operator++(int) const
constexpr ConstIterator begin() const
constexpr BufferRange()=default
constexpr Iterator begin()
constexpr BufferRange(T *buffer, int64_t start_elem_index, int64_t size, int elem_stride=1)
constexpr int64_t size() const
constexpr T * operator[](int64_t index) const
constexpr friend bool operator==(const BufferRange &a, const BufferRange &b)
constexpr ConstIterator end() const
local_group_size(16, 16) .push_constant(Type b