DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl_span.hpp
Go to the documentation of this file.
1 // -*- C++ -*-
2 //===------------------------------ span ---------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===---------------------------------------------------------------------===//
9 
10 #ifndef _SYCL_SPAN
11 #define _SYCL_SPAN
12 
13 /*
14  Derived from libcxx span.
15  Original _LIBCPP macros replaced with _SYCL_SPAN to avoid collisions.
16 
17 
18  span synopsis
19 
20 namespace std {
21 
22 // constants
23 inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
24 
25 // [views.span], class template span
26 template <class ElementType, size_t Extent = dynamic_extent>
27  class span;
28 
29 // [span.objectrep], views of object representation
30 template <class ElementType, size_t Extent>
31  span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :
32  (sizeof(ElementType) * Extent))> as_bytes(span<ElementType, Extent> s)
33 noexcept;
34 
35 template <class ElementType, size_t Extent>
36  span< byte, ((Extent == dynamic_extent) ? dynamic_extent :
37  (sizeof(ElementType) * Extent))> as_writable_bytes(span<ElementType,
38 Extent> s) noexcept;
39 
40 
41 namespace std {
42 template <class ElementType, size_t Extent = dynamic_extent>
43 class span {
44 public:
45  // constants and types
46  using element_type = ElementType;
47  using value_type = std::remove_cv_t<ElementType>;
48  using size_type = size_t;
49  using difference_type = ptrdiff_t;
50  using pointer = element_type*;
51  using const_pointer = const element_type*;
52  using reference = element_type&;
53  using const_reference = const element_type&;
54  using iterator = implementation-defined;
55  using reverse_iterator = std::reverse_iterator<iterator>;
56  static constexpr size_type extent = Extent;
57 
58  // [span.cons], span constructors, copy, assignment, and destructor
59  constexpr span() noexcept;
60  constexpr explicit(Extent != dynamic_extent) span(pointer ptr, size_type
61 count); constexpr explicit(Extent != dynamic_extent) span(pointer firstElem,
62 pointer lastElem); template <size_t N> constexpr span(element_type (&arr)[N])
63 noexcept; template <size_t N> constexpr span(array<value_type, N>& arr)
64 noexcept; template <size_t N> constexpr span(const array<value_type, N>& arr)
65 noexcept; template <class Container> constexpr explicit(Extent !=
66 dynamic_extent) span(Container& cont); template <class Container> constexpr
67 explicit(Extent != dynamic_extent) span(const Container& cont); constexpr
68 span(const span& other) noexcept = default; template <class OtherElementType,
69 size_t OtherExtent> constexpr explicit(Extent != dynamic_extent) span(const
70 span<OtherElementType, OtherExtent>& s) noexcept; ~span() noexcept = default;
71  constexpr span& operator=(const span& other) noexcept = default;
72 
73  // [span.sub], span subviews
74  template <size_t Count>
75  constexpr span<element_type, Count> first() const;
76  template <size_t Count>
77  constexpr span<element_type, Count> last() const;
78  template <size_t Offset, size_t Count = dynamic_extent>
79  constexpr span<element_type, see below> subspan() const;
80 
81  constexpr span<element_type, dynamic_extent> first(size_type count) const;
82  constexpr span<element_type, dynamic_extent> last(size_type count) const;
83  constexpr span<element_type, dynamic_extent> subspan(size_type offset,
84 size_type count = dynamic_extent) const;
85 
86  // [span.obs], span observers
87  constexpr size_type size() const noexcept;
88  constexpr size_type size_bytes() const noexcept;
89  constexpr bool empty() const noexcept;
90 
91  // [span.elem], span element access
92  constexpr reference operator[](size_type idx) const;
93  constexpr reference front() const;
94  constexpr reference back() const;
95  constexpr pointer data() const noexcept;
96 
97  // [span.iterators], span iterator support
98  constexpr iterator begin() const noexcept;
99  constexpr iterator end() const noexcept;
100  constexpr reverse_iterator rbegin() const noexcept;
101  constexpr reverse_iterator rend() const noexcept;
102 
103 private:
104  pointer data_; // exposition only
105  size_type size_; // exposition only
106 };
107 
108 template<class T, size_t N>
109  span(T (&)[N]) -> span<T, N>;
110 
111 template<class T, size_t N>
112  span(array<T, N>&) -> span<T, N>;
113 
114 template<class T, size_t N>
115  span(const array<T, N>&) -> span<const T, N>;
116 
117 template<class Container>
118  span(Container&) -> span<typename Container::value_type>;
119 
120 template<class Container>
121  span(const Container&) -> span<const typename Container::value_type>;
122 
123 } // namespace std
124 
125 */
126 
127 #include <array> // for array
128 #include <cassert> // for assert
129 #include <cstddef> // for size_t, nullptr_t, ptrdiff_t
130 #include <cstdint> // for SIZE_MAX
131 #include <iterator> // for size, data, distance, reverse_iterator
132 #include <type_traits> // for enable_if_t, enable_if, remove_cv_t, false_type
133 #include <utility> // for declval
134 
135 #define _SYCL_SPAN_TEMPLATE_VIS
136 #define _SYCL_SPAN_INLINE_VISIBILITY inline
137 
138 namespace sycl {
139 inline namespace _V1 {
140 
141 // byte is unsigned char at sycl/image.hpp:58
142 using byte = unsigned char;
143 
144 // asserts suppressed for device compatibility.
145 // TODO: enable
146 #if defined(__SYCL_DEVICE_ONLY__)
147 #define _SYCL_SPAN_ASSERT(x, m) ((void)0)
148 #else
149 #define _SYCL_SPAN_ASSERT(x, m) assert(((x) && m))
150 #endif
151 
152 inline constexpr size_t dynamic_extent = SIZE_MAX;
153 template <typename _Tp, size_t _Extent = dynamic_extent> class span;
154 
155 template <class _Tp> struct __is_span_impl : public std::false_type {};
156 
157 template <class _Tp, size_t _Extent>
158 struct __is_span_impl<span<_Tp, _Extent>> : public std::true_type {};
159 
160 template <class _Tp>
161 struct __is_span : public __is_span_impl<std::remove_cv_t<_Tp>> {};
162 
163 template <class _Tp> struct __is_std_array_impl : public std::false_type {};
164 
165 template <class _Tp, size_t _Sz>
166 struct __is_std_array_impl<std::array<_Tp, _Sz>> : public std::true_type {};
167 
168 template <class _Tp>
169 struct __is_std_array : public __is_std_array_impl<std::remove_cv_t<_Tp>> {};
170 
171 template <class _Tp, class _ElementType, class = void>
172 struct __is_span_compatible_container : public std::false_type {};
173 
174 template <class _Tp, class _ElementType>
176  _Tp, _ElementType,
177  std::void_t<
178  // is not a specialization of span
179  typename std::enable_if<!__is_span<_Tp>::value, std::nullptr_t>::type,
180  // is not a specialization of array
181  typename std::enable_if<!__is_std_array<_Tp>::value,
182  std::nullptr_t>::type,
183  // is_array_v<Container> is false,
184  typename std::enable_if<!std::is_array_v<_Tp>, std::nullptr_t>::type,
185  // data(cont) and size(cont) are well formed
186  decltype(data(std::declval<_Tp>())),
187  decltype(size(std::declval<_Tp>())),
188  // remove_pointer_t<decltype(data(cont))>(*)[] is convertible to
189  // ElementType(*)[]
190  typename std::enable_if<
191  std::is_convertible_v<std::remove_pointer_t<decltype(data(
192  std::declval<_Tp &>()))> (*)[],
193  _ElementType (*)[]>,
194  std::nullptr_t>::type>> : public std::true_type {};
195 
196 template <typename _Tp, size_t _Extent> class _SYCL_SPAN_TEMPLATE_VIS span {
197 public:
198  // constants and types
199  using element_type = _Tp;
200  using value_type = std::remove_cv_t<_Tp>;
201  using size_type = size_t;
202  using difference_type = ptrdiff_t;
203  using pointer = _Tp *;
204  using const_pointer = const _Tp *;
205  using reference = _Tp &;
206  using const_reference = const _Tp &;
207  using iterator = pointer;
208  using rev_iterator = std::reverse_iterator<pointer>;
209 
210  static constexpr size_type extent = _Extent;
211 
212  // [span.cons], span constructors, copy, assignment, and destructor
213  template <size_t _Sz = _Extent,
214  std::enable_if_t<_Sz == 0, std::nullptr_t> = nullptr>
215  _SYCL_SPAN_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {}
216 
217  constexpr span(const span &) noexcept = default;
218  constexpr span &operator=(const span &) noexcept = default;
219 
220  template <size_t _Sz = _Extent>
221  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(
222  element_type (&__arr)[_Sz])
223  : __data{__arr} {
224  (void)_Sz;
225  _SYCL_SPAN_ASSERT(_Extent == _Sz,
226  "size mismatch in span's constructor (&_arr)[_Sz]");
227  }
228 
229  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(pointer __ptr,
230  size_type __count)
231  : __data{__ptr} {
232  (void)__count;
233  _SYCL_SPAN_ASSERT(_Extent == __count,
234  "size mismatch in span's constructor (ptr, len)");
235  }
236  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(pointer __f, pointer __l)
237  : __data{__f} {
238  (void)__l;
239  _SYCL_SPAN_ASSERT(_Extent == std::distance(__f, __l),
240  "size mismatch in span's constructor (ptr, ptr)");
241  }
242 
243  template <class _OtherElementType,
244  std::enable_if_t<std::is_convertible_v<_OtherElementType (*)[],
245  element_type (*)[]>,
246  std::nullptr_t> = nullptr>
248  std::array<_OtherElementType, _Extent> &__arr) noexcept
249  : __data{__arr.data()} {}
250 
251  template <
252  class _OtherElementType,
253  std::enable_if_t<std::is_convertible_v<const _OtherElementType (*)[],
254  element_type (*)[]>,
255  std::nullptr_t> = nullptr>
257  const std::array<_OtherElementType, _Extent> &__arr) noexcept
258  : __data{__arr.data()} {}
259 
260  template <class _Container>
261  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(
262  _Container &__c,
264  std::nullptr_t> = nullptr)
265  : __data{std::data(__c)} {
266  _SYCL_SPAN_ASSERT(_Extent == std::size(__c),
267  "size mismatch in span's constructor (range)");
268  }
269 
270  template <class _Container>
271  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(
272  const _Container &__c,
273  std::enable_if_t<
275  std::nullptr_t> = nullptr)
276  : __data{std::data(__c)} {
277  _SYCL_SPAN_ASSERT(_Extent == std::size(__c),
278  "size mismatch in span's constructor (range)");
279  }
280 
281  template <class _OtherElementType>
283  const span<_OtherElementType, _Extent> &__other,
284  std::enable_if_t<
285  std::is_convertible_v<_OtherElementType (*)[], element_type (*)[]>,
286  std::nullptr_t> = nullptr)
287  : __data{__other.data()} {}
288 
289  // ~span() noexcept = default;
290 
291  template <size_t _Count>
293  first() const noexcept {
294  static_assert(_Count <= _Extent, "Count out of range in span::first()");
295  return span<element_type, _Count>{data(), _Count};
296  }
297 
298  template <size_t _Count>
300  last() const noexcept {
301  static_assert(_Count <= _Extent, "Count out of range in span::last()");
302  return span<element_type, _Count>{data() + size() - _Count, _Count};
303  }
304 
307  first(size_type __count) const noexcept {
308  _SYCL_SPAN_ASSERT(__count <= size(),
309  "Count out of range in span::first(count)");
310  return {data(), __count};
311  }
312 
315  last(size_type __count) const noexcept {
316  _SYCL_SPAN_ASSERT(__count <= size(),
317  "Count out of range in span::last(count)");
318  return {data() + size() - __count, __count};
319  }
320 
321  template <size_t _Offset, size_t _Count = dynamic_extent>
323  -> span<element_type,
324  (_Count != dynamic_extent ? _Count : _Extent - _Offset)> {
325  static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()");
326  static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
327  "Offset + count out of range in span::subspan()");
328 
329  using _ReturnType =
331  _Count != dynamic_extent ? _Count : _Extent - _Offset>;
332  return _ReturnType{data() + _Offset,
333  _Count == dynamic_extent ? size() - _Offset : _Count};
334  }
335 
338  subspan(size_type __offset,
339  size_type __count = dynamic_extent) const noexcept {
340  _SYCL_SPAN_ASSERT(__offset <= size(),
341  "Offset out of range in span::subspan(offset, count)");
342  _SYCL_SPAN_ASSERT(__count <= size() || __count == dynamic_extent,
343  "Count out of range in span::subspan(offset, count)");
344  if (__count == dynamic_extent)
345  return {data() + __offset, size() - __offset};
347  __count <= size() - __offset,
348  "Offset + count out of range in span::subspan(offset, count)");
349  return {data() + __offset, __count};
350  }
351 
353  return _Extent;
354  }
356  return _Extent * sizeof(element_type);
357  }
358  _SYCL_SPAN_INLINE_VISIBILITY constexpr bool empty() const noexcept {
359  return _Extent == 0;
360  }
361 
364  _SYCL_SPAN_ASSERT(__idx < size(), "span<T,N>[] index out of bounds");
365  return __data[__idx];
366  }
367 
369  _SYCL_SPAN_ASSERT(!empty(), "span<T, N>::front() on empty span");
370  return __data[0];
371  }
372 
374  _SYCL_SPAN_ASSERT(!empty(), "span<T, N>::back() on empty span");
375  return __data[size() - 1];
376  }
377 
379  return __data;
380  }
381 
382  // [span.iter], span iterator support
384  return iterator(data());
385  }
387  return iterator(data() + size());
388  }
390  return rev_iterator(end());
391  }
393  return rev_iterator(begin());
394  }
395 
396  _SYCL_SPAN_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)>
398  return span<const byte, _Extent * sizeof(element_type)>{
399  reinterpret_cast<const byte *>(data()), size_bytes()};
400  }
401 
402  _SYCL_SPAN_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)>
404  return span<byte, _Extent * sizeof(element_type)>{
405  reinterpret_cast<byte *>(data()), size_bytes()};
406  }
407 
408 private:
409  pointer __data;
410 };
411 
412 template <typename _Tp>
414 private:
415 public:
416  // constants and types
417  using element_type = _Tp;
418  using value_type = std::remove_cv_t<_Tp>;
419  using size_type = size_t;
420  using difference_type = ptrdiff_t;
421  using pointer = _Tp *;
422  using const_pointer = const _Tp *;
423  using reference = _Tp &;
424  using const_reference = const _Tp &;
425  using iterator = pointer;
426  using rev_iterator = std::reverse_iterator<pointer>;
427 
428  static constexpr size_type extent = dynamic_extent;
429 
430  // [span.cons], span constructors, copy, assignment, and destructor
432  : __data{nullptr}, __size{0} {}
433 
434  constexpr span(const span &) noexcept = default;
435  constexpr span &operator=(const span &) noexcept = default;
436 
438  : __data{__ptr}, __size{__count} {}
440  : __data{__f}, __size{static_cast<size_t>(std::distance(__f, __l))} {}
441 
442  template <size_t _Sz>
444  element_type (&__arr)[_Sz]) noexcept
445  : __data{__arr}, __size{_Sz} {}
446 
447  template <class _OtherElementType, size_t _Sz,
448  std::enable_if_t<std::is_convertible_v<_OtherElementType (*)[],
449  element_type (*)[]>,
450  std::nullptr_t> = nullptr>
452  std::array<_OtherElementType, _Sz> &__arr) noexcept
453  : __data{__arr.data()}, __size{_Sz} {}
454 
455  template <
456  class _OtherElementType, size_t _Sz,
457  std::enable_if_t<std::is_convertible_v<const _OtherElementType (*)[],
458  element_type (*)[]>,
459  std::nullptr_t> = nullptr>
461  const std::array<_OtherElementType, _Sz> &__arr) noexcept
462  : __data{__arr.data()}, __size{_Sz} {}
463 
464  template <class _Container>
466  _Container &__c,
468  std::nullptr_t> = nullptr)
469  : __data{std::data(__c)}, __size{(size_type)std::size(__c)} {}
470 
471  template <class _Container>
473  const _Container &__c,
474  std::enable_if_t<
476  std::nullptr_t> = nullptr)
477  : __data{std::data(__c)}, __size{(size_type)std::size(__c)} {}
478 
479  template <class _OtherElementType, size_t _OtherExtent>
482  std::enable_if_t<
483  std::is_convertible_v<_OtherElementType (*)[], element_type (*)[]>,
484  std::nullptr_t> = nullptr) noexcept
485  : __data{__other.data()}, __size{__other.size()} {}
486 
487  // ~span() noexcept = default;
488 
489  template <size_t _Count>
490  _SYCL_SPAN_INLINE_VISIBILITY constexpr span<element_type, _Count>
491  first() const noexcept {
492  _SYCL_SPAN_ASSERT(_Count <= size(), "Count out of range in span::first()");
493  return span<element_type, _Count>{data(), _Count};
494  }
495 
496  template <size_t _Count>
498  last() const noexcept {
499  _SYCL_SPAN_ASSERT(_Count <= size(), "Count out of range in span::last()");
500  return span<element_type, _Count>{data() + size() - _Count, _Count};
501  }
502 
505  first(size_type __count) const noexcept {
506  _SYCL_SPAN_ASSERT(__count <= size(),
507  "Count out of range in span::first(count)");
508  return {data(), __count};
509  }
510 
513  last(size_type __count) const noexcept {
514  _SYCL_SPAN_ASSERT(__count <= size(),
515  "Count out of range in span::last(count)");
516  return {data() + size() - __count, __count};
517  }
518 
519  template <size_t _Offset, size_t _Count = dynamic_extent>
521  subspan() const noexcept {
522  _SYCL_SPAN_ASSERT(_Offset <= size(),
523  "Offset out of range in span::subspan()");
524  _SYCL_SPAN_ASSERT(_Count == dynamic_extent || _Count <= size() - _Offset,
525  "Offset + count out of range in span::subspan()");
527  data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
528  }
529 
531  subspan(size_type __offset,
532  size_type __count = dynamic_extent) const noexcept {
533  _SYCL_SPAN_ASSERT(__offset <= size(),
534  "Offset out of range in span::subspan(offset, count)");
535  _SYCL_SPAN_ASSERT(__count <= size() || __count == dynamic_extent,
536  "count out of range in span::subspan(offset, count)");
537  if (__count == dynamic_extent)
538  return {data() + __offset, size() - __offset};
540  __count <= size() - __offset,
541  "Offset + count out of range in span::subspan(offset, count)");
542  return {data() + __offset, __count};
543  }
544 
546  return __size;
547  }
549  return __size * sizeof(element_type);
550  }
551  _SYCL_SPAN_INLINE_VISIBILITY constexpr bool empty() const noexcept {
552  return __size == 0;
553  }
554 
557  _SYCL_SPAN_ASSERT(__idx < size(), "span<T>[] index out of bounds");
558  return __data[__idx];
559  }
560 
562  _SYCL_SPAN_ASSERT(!empty(), "span<T>[].front() on empty span");
563  return __data[0];
564  }
565 
567  _SYCL_SPAN_ASSERT(!empty(), "span<T>[].back() on empty span");
568  return __data[size() - 1];
569  }
570 
572  return __data;
573  }
574 
575  // [span.iter], span iterator support
577  return iterator(data());
578  }
580  return iterator(data() + size());
581  }
583  return rev_iterator(end());
584  }
586  return rev_iterator(begin());
587  }
588 
591  return {reinterpret_cast<const byte *>(data()), size_bytes()};
592  }
593 
596  return {reinterpret_cast<byte *>(data()), size_bytes()};
597  }
598 
599 private:
600  pointer __data;
601  size_type __size;
602 };
603 
604 // as_bytes & as_writable_bytes
605 template <class _Tp, size_t _Extent>
607  -> decltype(__s.__as_bytes()) {
608  return __s.__as_bytes();
609 }
610 
611 template <class _Tp, size_t _Extent>
614  -> std::enable_if_t<!std::is_const_v<_Tp>,
615  decltype(__s.__as_writable_bytes())> {
616  return __s.__as_writable_bytes();
617 }
618 
619 // Deduction guides
620 
621 // array arg deduction guide
622 template <class _Tp, size_t _Sz>
623 span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
624 
625 template <class _Tp, size_t _Sz> span(std::array<_Tp, _Sz> &) -> span<_Tp, _Sz>;
626 
627 template <class _Tp, size_t _Sz>
628 span(const std::array<_Tp, _Sz> &) -> span<const _Tp, _Sz>;
629 
630 template <class _Container>
632 
633 template <class _Container>
635 
636 } // namespace _V1
637 } // namespace sycl
638 
639 #endif // _SYCL_SPAN
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > last() const noexcept
Definition: sycl_span.hpp:498
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(const span< _OtherElementType, _OtherExtent > &__other, std::enable_if_t< std::is_convertible_v< _OtherElementType(*)[], element_type(*)[]>, std::nullptr_t >=nullptr) noexcept
Definition: sycl_span.hpp:480
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(const std::array< _OtherElementType, _Sz > &__arr) noexcept
Definition: sycl_span.hpp:460
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference front() const noexcept
Definition: sycl_span.hpp:561
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(std::array< _OtherElementType, _Sz > &__arr) noexcept
Definition: sycl_span.hpp:451
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(const _Container &__c, std::enable_if_t< __is_span_compatible_container< const _Container, _Tp >::value, std::nullptr_t >=nullptr)
Definition: sycl_span.hpp:472
constexpr span(const span &) noexcept=default
std::reverse_iterator< pointer > rev_iterator
Definition: sycl_span.hpp:426
constexpr span & operator=(const span &) noexcept=default
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, dynamic_extent > first(size_type __count) const noexcept
Definition: sycl_span.hpp:505
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(pointer __ptr, size_type __count)
Definition: sycl_span.hpp:437
_SYCL_SPAN_INLINE_VISIBILITY span< const byte, dynamic_extent > __as_bytes() const noexcept
Definition: sycl_span.hpp:590
constexpr _SYCL_SPAN_INLINE_VISIBILITY size_type size_bytes() const noexcept
Definition: sycl_span.hpp:548
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference operator[](size_type __idx) const noexcept
Definition: sycl_span.hpp:556
constexpr _SYCL_SPAN_INLINE_VISIBILITY pointer data() const noexcept
Definition: sycl_span.hpp:571
constexpr _SYCL_SPAN_INLINE_VISIBILITY iterator begin() const noexcept
Definition: sycl_span.hpp:576
constexpr _SYCL_SPAN_INLINE_VISIBILITY iterator end() const noexcept
Definition: sycl_span.hpp:579
constexpr span< element_type, dynamic_extent > _SYCL_SPAN_INLINE_VISIBILITY subspan(size_type __offset, size_type __count=dynamic_extent) const noexcept
Definition: sycl_span.hpp:531
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, dynamic_extent > last(size_type __count) const noexcept
Definition: sycl_span.hpp:513
constexpr _SYCL_SPAN_INLINE_VISIBILITY size_type size() const noexcept
Definition: sycl_span.hpp:545
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > first() const noexcept
Definition: sycl_span.hpp:491
constexpr _SYCL_SPAN_INLINE_VISIBILITY bool empty() const noexcept
Definition: sycl_span.hpp:551
constexpr _SYCL_SPAN_INLINE_VISIBILITY rev_iterator rbegin() const noexcept
Definition: sycl_span.hpp:582
std::remove_cv_t< _Tp > value_type
Definition: sycl_span.hpp:418
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(_Container &__c, std::enable_if_t< __is_span_compatible_container< _Container, _Tp >::value, std::nullptr_t >=nullptr)
Definition: sycl_span.hpp:465
constexpr _SYCL_SPAN_INLINE_VISIBILITY rev_iterator rend() const noexcept
Definition: sycl_span.hpp:585
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(pointer __f, pointer __l)
Definition: sycl_span.hpp:439
constexpr _SYCL_SPAN_INLINE_VISIBILITY span() noexcept
Definition: sycl_span.hpp:431
_SYCL_SPAN_INLINE_VISIBILITY span< byte, dynamic_extent > __as_writable_bytes() const noexcept
Definition: sycl_span.hpp:595
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference back() const noexcept
Definition: sycl_span.hpp:566
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(element_type(&__arr)[_Sz]) noexcept
Definition: sycl_span.hpp:443
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > subspan() const noexcept
Definition: sycl_span.hpp:521
const _Tp * const_pointer
Definition: sycl_span.hpp:204
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference front() const noexcept
Definition: sycl_span.hpp:368
constexpr _SYCL_SPAN_INLINE_VISIBILITY span() noexcept
Definition: sycl_span.hpp:215
constexpr _SYCL_SPAN_INLINE_VISIBILITY bool empty() const noexcept
Definition: sycl_span.hpp:358
const _Tp & const_reference
Definition: sycl_span.hpp:206
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(const span< _OtherElementType, _Extent > &__other, std::enable_if_t< std::is_convertible_v< _OtherElementType(*)[], element_type(*)[]>, std::nullptr_t >=nullptr)
Definition: sycl_span.hpp:282
constexpr _SYCL_SPAN_INLINE_VISIBILITY iterator end() const noexcept
Definition: sycl_span.hpp:386
constexpr _SYCL_SPAN_INLINE_VISIBILITY size_type size() const noexcept
Definition: sycl_span.hpp:352
constexpr _SYCL_SPAN_INLINE_VISIBILITY pointer data() const noexcept
Definition: sycl_span.hpp:378
constexpr span & operator=(const span &) noexcept=default
constexpr span(const span &) noexcept=default
_SYCL_SPAN_INLINE_VISIBILITY span< byte, _Extent *sizeof(element_type)> __as_writable_bytes() const noexcept
Definition: sycl_span.hpp:403
constexpr _SYCL_SPAN_INLINE_VISIBILITY size_type size_bytes() const noexcept
Definition: sycl_span.hpp:355
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference operator[](size_type __idx) const noexcept
Definition: sycl_span.hpp:363
constexpr _SYCL_SPAN_INLINE_VISIBILITY rev_iterator rend() const noexcept
Definition: sycl_span.hpp:392
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference back() const noexcept
Definition: sycl_span.hpp:373
ptrdiff_t difference_type
Definition: sycl_span.hpp:202
constexpr _SYCL_SPAN_INLINE_VISIBILITY iterator begin() const noexcept
Definition: sycl_span.hpp:383
_SYCL_SPAN_INLINE_VISIBILITY span< const byte, _Extent *sizeof(element_type)> __as_bytes() const noexcept
Definition: sycl_span.hpp:397
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(pointer __ptr, size_type __count)
Definition: sycl_span.hpp:229
pointer iterator
Definition: sycl_span.hpp:207
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, dynamic_extent > last(size_type __count) const noexcept
Definition: sycl_span.hpp:315
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, dynamic_extent > first(size_type __count) const noexcept
Definition: sycl_span.hpp:307
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, dynamic_extent > subspan(size_type __offset, size_type __count=dynamic_extent) const noexcept
Definition: sycl_span.hpp:338
std::reverse_iterator< pointer > rev_iterator
Definition: sycl_span.hpp:208
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(pointer __f, pointer __l)
Definition: sycl_span.hpp:236
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(const _Container &__c, std::enable_if_t< __is_span_compatible_container< const _Container, _Tp >::value, std::nullptr_t >=nullptr)
Definition: sycl_span.hpp:271
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(_Container &__c, std::enable_if_t< __is_span_compatible_container< _Container, _Tp >::value, std::nullptr_t >=nullptr)
Definition: sycl_span.hpp:261
std::remove_cv_t< _Tp > value_type
Definition: sycl_span.hpp:200
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(element_type(&__arr)[_Sz])
Definition: sycl_span.hpp:221
constexpr _SYCL_SPAN_INLINE_VISIBILITY auto subspan() const noexcept -> span< element_type,(_Count !=dynamic_extent ? _Count :_Extent - _Offset)>
Definition: sycl_span.hpp:322
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(std::array< _OtherElementType, _Extent > &__arr) noexcept
Definition: sycl_span.hpp:247
constexpr _SYCL_SPAN_INLINE_VISIBILITY rev_iterator rbegin() const noexcept
Definition: sycl_span.hpp:389
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > last() const noexcept
Definition: sycl_span.hpp:300
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > first() const noexcept
Definition: sycl_span.hpp:293
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(const std::array< _OtherElementType, _Extent > &__arr) noexcept
Definition: sycl_span.hpp:256
sycl::ext::oneapi::experimental::annotated_ref< T, property_list_t > reference
unsigned char byte
Definition: image.hpp:107
_SYCL_SPAN_INLINE_VISIBILITY auto as_writable_bytes(span< _Tp, _Extent > __s) noexcept -> std::enable_if_t<!std::is_const_v< _Tp >, decltype(__s.__as_writable_bytes())>
Definition: sycl_span.hpp:613
std::conditional_t< is_decorated, decorated_type *, std::add_pointer_t< value_type > > pointer
Definition: multi_ptr.hpp:459
span(_Tp(&)[_Sz]) -> span< _Tp, _Sz >
constexpr size_t dynamic_extent
Definition: sycl_span.hpp:152
_SYCL_SPAN_INLINE_VISIBILITY auto as_bytes(span< _Tp, _Extent > __s) noexcept -> decltype(__s.__as_bytes())
Definition: sycl_span.hpp:606
Definition: access.hpp:18
_Abi const simd< _Tp, _Abi > & noexcept
Definition: simd.hpp:1324
#define _SYCL_SPAN_INLINE_VISIBILITY
Definition: sycl_span.hpp:136
#define _SYCL_SPAN_ASSERT(x, m)
Definition: sycl_span.hpp:149
#define _SYCL_SPAN_TEMPLATE_VIS
Definition: sycl_span.hpp:135