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 byte
130 #include <iterator> // for iterators
131 #include <type_traits> // for remove_cv, etc
132 
133 #define _SYCL_SPAN_TEMPLATE_VIS
134 #define _SYCL_SPAN_INLINE_VISIBILITY inline
135 
136 namespace sycl {
138 
139 // byte is unsigned char at sycl/image.hpp:58
140 using byte = unsigned char;
141 
142 // asserts suppressed for device compatibility.
143 // TODO: enable
144 #if defined(__SYCL_DEVICE_ONLY__)
145 #define _SYCL_SPAN_ASSERT(x, m) ((void)0)
146 #else
147 #define _SYCL_SPAN_ASSERT(x, m) assert(((x) && m))
148 #endif
149 
150 inline constexpr size_t dynamic_extent = SIZE_MAX;
151 template <typename _Tp, size_t _Extent = dynamic_extent> class span;
152 
153 template <class _Tp> struct __is_span_impl : public std::false_type {};
154 
155 template <class _Tp, size_t _Extent>
156 struct __is_span_impl<span<_Tp, _Extent>> : public std::true_type {};
157 
158 template <class _Tp>
159 struct __is_span : public __is_span_impl<std::remove_cv_t<_Tp>> {};
160 
161 template <class _Tp> struct __is_std_array_impl : public std::false_type {};
162 
163 template <class _Tp, size_t _Sz>
164 struct __is_std_array_impl<std::array<_Tp, _Sz>> : public std::true_type {};
165 
166 template <class _Tp>
167 struct __is_std_array : public __is_std_array_impl<std::remove_cv_t<_Tp>> {};
168 
169 template <class _Tp, class _ElementType, class = void>
170 struct __is_span_compatible_container : public std::false_type {};
171 
172 template <class _Tp, class _ElementType>
174  _Tp, _ElementType,
175  std::void_t<
176  // is not a specialization of span
177  typename std::enable_if<!__is_span<_Tp>::value, std::nullptr_t>::type,
178  // is not a specialization of array
179  typename std::enable_if<!__is_std_array<_Tp>::value,
180  std::nullptr_t>::type,
181  // is_array_v<Container> is false,
182  typename std::enable_if<!std::is_array_v<_Tp>, std::nullptr_t>::type,
183  // data(cont) and size(cont) are well formed
184  decltype(data(std::declval<_Tp>())),
185  decltype(size(std::declval<_Tp>())),
186  // remove_pointer_t<decltype(data(cont))>(*)[] is convertible to
187  // ElementType(*)[]
188  typename std::enable_if<
189  std::is_convertible_v<std::remove_pointer_t<decltype(data(
190  std::declval<_Tp &>()))> (*)[],
191  _ElementType (*)[]>,
192  std::nullptr_t>::type>> : public std::true_type {};
193 
194 template <typename _Tp, size_t _Extent> class _SYCL_SPAN_TEMPLATE_VIS span {
195 public:
196  // constants and types
197  using element_type = _Tp;
198  using value_type = std::remove_cv_t<_Tp>;
199  using size_type = size_t;
200  using difference_type = ptrdiff_t;
201  using pointer = _Tp *;
202  using const_pointer = const _Tp *;
203  using reference = _Tp &;
204  using const_reference = const _Tp &;
205  using iterator = pointer;
206  using rev_iterator = std::reverse_iterator<pointer>;
207 
208  static constexpr size_type extent = _Extent;
209 
210  // [span.cons], span constructors, copy, assignment, and destructor
211  template <size_t _Sz = _Extent,
212  std::enable_if_t<_Sz == 0, std::nullptr_t> = nullptr>
213  _SYCL_SPAN_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {}
214 
215  constexpr span(const span &) noexcept = default;
216  constexpr span &operator=(const span &) noexcept = default;
217 
218  template <size_t _Sz = _Extent>
219  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(
220  element_type (&__arr)[_Sz])
221  : __data{__arr} {
222  (void)_Sz;
223  _SYCL_SPAN_ASSERT(_Extent == _Sz,
224  "size mismatch in span's constructor (&_arr)[_Sz]");
225  }
226 
227  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(pointer __ptr,
228  size_type __count)
229  : __data{__ptr} {
230  (void)__count;
231  _SYCL_SPAN_ASSERT(_Extent == __count,
232  "size mismatch in span's constructor (ptr, len)");
233  }
234  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(pointer __f, pointer __l)
235  : __data{__f} {
236  (void)__l;
237  _SYCL_SPAN_ASSERT(_Extent == std::distance(__f, __l),
238  "size mismatch in span's constructor (ptr, ptr)");
239  }
240 
241  template <class _OtherElementType,
242  std::enable_if_t<std::is_convertible_v<_OtherElementType (*)[],
243  element_type (*)[]>,
244  std::nullptr_t> = nullptr>
246  std::array<_OtherElementType, _Extent> &__arr) noexcept
247  : __data{__arr.data()} {}
248 
249  template <
250  class _OtherElementType,
251  std::enable_if_t<std::is_convertible_v<const _OtherElementType (*)[],
252  element_type (*)[]>,
253  std::nullptr_t> = nullptr>
255  const std::array<_OtherElementType, _Extent> &__arr) noexcept
256  : __data{__arr.data()} {}
257 
258  template <class _Container>
259  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(
260  _Container &__c,
262  std::nullptr_t> = nullptr)
263  : __data{std::data(__c)} {
264  _SYCL_SPAN_ASSERT(_Extent == std::size(__c),
265  "size mismatch in span's constructor (range)");
266  }
267 
268  template <class _Container>
269  _SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(
270  const _Container &__c,
273  std::nullptr_t> = nullptr)
274  : __data{std::data(__c)} {
275  _SYCL_SPAN_ASSERT(_Extent == std::size(__c),
276  "size mismatch in span's constructor (range)");
277  }
278 
279  template <class _OtherElementType>
281  const span<_OtherElementType, _Extent> &__other,
283  std::is_convertible_v<_OtherElementType (*)[], element_type (*)[]>,
284  std::nullptr_t> = nullptr)
285  : __data{__other.data()} {}
286 
287  // ~span() noexcept = default;
288 
289  template <size_t _Count>
290  _SYCL_SPAN_INLINE_VISIBILITY constexpr span<element_type, _Count>
291  first() const noexcept {
292  static_assert(_Count <= _Extent, "Count out of range in span::first()");
293  return span<element_type, _Count>{data(), _Count};
294  }
295 
296  template <size_t _Count>
298  last() const noexcept {
299  static_assert(_Count <= _Extent, "Count out of range in span::last()");
300  return span<element_type, _Count>{data() + size() - _Count, _Count};
301  }
302 
305  first(size_type __count) const noexcept {
306  _SYCL_SPAN_ASSERT(__count <= size(),
307  "Count out of range in span::first(count)");
308  return {data(), __count};
309  }
310 
313  last(size_type __count) const noexcept {
314  _SYCL_SPAN_ASSERT(__count <= size(),
315  "Count out of range in span::last(count)");
316  return {data() + size() - __count, __count};
317  }
318 
319  template <size_t _Offset, size_t _Count = dynamic_extent>
320  _SYCL_SPAN_INLINE_VISIBILITY constexpr auto subspan() const noexcept
321  -> span<element_type,
322  (_Count != dynamic_extent ? _Count : _Extent - _Offset)> {
323  static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()");
324  static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
325  "Offset + count out of range in span::subspan()");
326 
327  using _ReturnType =
329  _Count != dynamic_extent ? _Count : _Extent - _Offset>;
330  return _ReturnType{data() + _Offset,
331  _Count == dynamic_extent ? size() - _Offset : _Count};
332  }
333 
336  subspan(size_type __offset,
337  size_type __count = dynamic_extent) const noexcept {
338  _SYCL_SPAN_ASSERT(__offset <= size(),
339  "Offset out of range in span::subspan(offset, count)");
340  _SYCL_SPAN_ASSERT(__count <= size() || __count == dynamic_extent,
341  "Count out of range in span::subspan(offset, count)");
342  if (__count == dynamic_extent)
343  return {data() + __offset, size() - __offset};
345  __count <= size() - __offset,
346  "Offset + count out of range in span::subspan(offset, count)");
347  return {data() + __offset, __count};
348  }
349 
350  _SYCL_SPAN_INLINE_VISIBILITY constexpr size_type size() const noexcept {
351  return _Extent;
352  }
353  _SYCL_SPAN_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept {
354  return _Extent * sizeof(element_type);
355  }
356  _SYCL_SPAN_INLINE_VISIBILITY constexpr bool empty() const noexcept {
357  return _Extent == 0;
358  }
359 
361  operator[](size_type __idx) const noexcept {
362  _SYCL_SPAN_ASSERT(__idx < size(), "span<T,N>[] index out of bounds");
363  return __data[__idx];
364  }
365 
366  _SYCL_SPAN_INLINE_VISIBILITY constexpr reference front() const noexcept {
367  _SYCL_SPAN_ASSERT(!empty(), "span<T, N>::front() on empty span");
368  return __data[0];
369  }
370 
371  _SYCL_SPAN_INLINE_VISIBILITY constexpr reference back() const noexcept {
372  _SYCL_SPAN_ASSERT(!empty(), "span<T, N>::back() on empty span");
373  return __data[size() - 1];
374  }
375 
376  _SYCL_SPAN_INLINE_VISIBILITY constexpr pointer data() const noexcept {
377  return __data;
378  }
379 
380  // [span.iter], span iterator support
381  _SYCL_SPAN_INLINE_VISIBILITY constexpr iterator begin() const noexcept {
382  return iterator(data());
383  }
384  _SYCL_SPAN_INLINE_VISIBILITY constexpr iterator end() const noexcept {
385  return iterator(data() + size());
386  }
387  _SYCL_SPAN_INLINE_VISIBILITY constexpr rev_iterator rbegin() const noexcept {
388  return rev_iterator(end());
389  }
390  _SYCL_SPAN_INLINE_VISIBILITY constexpr rev_iterator rend() const noexcept {
391  return rev_iterator(begin());
392  }
393 
394  _SYCL_SPAN_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)>
395  __as_bytes() const noexcept {
396  return span<const byte, _Extent * sizeof(element_type)>{
397  reinterpret_cast<const byte *>(data()), size_bytes()};
398  }
399 
400  _SYCL_SPAN_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)>
401  __as_writable_bytes() const noexcept {
402  return span<byte, _Extent * sizeof(element_type)>{
403  reinterpret_cast<byte *>(data()), size_bytes()};
404  }
405 
406 private:
407  pointer __data;
408 };
409 
410 template <typename _Tp>
412 private:
413 public:
414  // constants and types
415  using element_type = _Tp;
416  using value_type = std::remove_cv_t<_Tp>;
417  using size_type = size_t;
418  using difference_type = ptrdiff_t;
419  using pointer = _Tp *;
420  using const_pointer = const _Tp *;
421  using reference = _Tp &;
422  using const_reference = const _Tp &;
423  using iterator = pointer;
424  using rev_iterator = std::reverse_iterator<pointer>;
425 
426  static constexpr size_type extent = dynamic_extent;
427 
428  // [span.cons], span constructors, copy, assignment, and destructor
429  _SYCL_SPAN_INLINE_VISIBILITY constexpr span() noexcept
430  : __data{nullptr}, __size{0} {}
431 
432  constexpr span(const span &) noexcept = default;
433  constexpr span &operator=(const span &) noexcept = default;
434 
436  : __data{__ptr}, __size{__count} {}
438  : __data{__f}, __size{static_cast<size_t>(std::distance(__f, __l))} {}
439 
440  template <size_t _Sz>
442  element_type (&__arr)[_Sz]) noexcept
443  : __data{__arr}, __size{_Sz} {}
444 
445  template <class _OtherElementType, size_t _Sz,
446  std::enable_if_t<std::is_convertible_v<_OtherElementType (*)[],
447  element_type (*)[]>,
448  std::nullptr_t> = nullptr>
450  std::array<_OtherElementType, _Sz> &__arr) noexcept
451  : __data{__arr.data()}, __size{_Sz} {}
452 
453  template <
454  class _OtherElementType, size_t _Sz,
455  std::enable_if_t<std::is_convertible_v<const _OtherElementType (*)[],
456  element_type (*)[]>,
457  std::nullptr_t> = nullptr>
459  const std::array<_OtherElementType, _Sz> &__arr) noexcept
460  : __data{__arr.data()}, __size{_Sz} {}
461 
462  template <class _Container>
464  _Container &__c,
466  std::nullptr_t> = nullptr)
467  : __data{std::data(__c)}, __size{(size_type)std::size(__c)} {}
468 
469  template <class _Container>
471  const _Container &__c,
474  std::nullptr_t> = nullptr)
475  : __data{std::data(__c)}, __size{(size_type)std::size(__c)} {}
476 
477  template <class _OtherElementType, size_t _OtherExtent>
481  std::is_convertible_v<_OtherElementType (*)[], element_type (*)[]>,
482  std::nullptr_t> = nullptr) noexcept
483  : __data{__other.data()}, __size{__other.size()} {}
484 
485  // ~span() noexcept = default;
486 
487  template <size_t _Count>
488  _SYCL_SPAN_INLINE_VISIBILITY constexpr span<element_type, _Count>
489  first() const noexcept {
490  _SYCL_SPAN_ASSERT(_Count <= size(), "Count out of range in span::first()");
491  return span<element_type, _Count>{data(), _Count};
492  }
493 
494  template <size_t _Count>
496  last() const noexcept {
497  _SYCL_SPAN_ASSERT(_Count <= size(), "Count out of range in span::last()");
498  return span<element_type, _Count>{data() + size() - _Count, _Count};
499  }
500 
503  first(size_type __count) const noexcept {
504  _SYCL_SPAN_ASSERT(__count <= size(),
505  "Count out of range in span::first(count)");
506  return {data(), __count};
507  }
508 
511  last(size_type __count) const noexcept {
512  _SYCL_SPAN_ASSERT(__count <= size(),
513  "Count out of range in span::last(count)");
514  return {data() + size() - __count, __count};
515  }
516 
517  template <size_t _Offset, size_t _Count = dynamic_extent>
519  subspan() const noexcept {
520  _SYCL_SPAN_ASSERT(_Offset <= size(),
521  "Offset out of range in span::subspan()");
522  _SYCL_SPAN_ASSERT(_Count == dynamic_extent || _Count <= size() - _Offset,
523  "Offset + count out of range in span::subspan()");
525  data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
526  }
527 
529  subspan(size_type __offset,
530  size_type __count = dynamic_extent) const noexcept {
531  _SYCL_SPAN_ASSERT(__offset <= size(),
532  "Offset out of range in span::subspan(offset, count)");
533  _SYCL_SPAN_ASSERT(__count <= size() || __count == dynamic_extent,
534  "count out of range in span::subspan(offset, count)");
535  if (__count == dynamic_extent)
536  return {data() + __offset, size() - __offset};
538  __count <= size() - __offset,
539  "Offset + count out of range in span::subspan(offset, count)");
540  return {data() + __offset, __count};
541  }
542 
543  _SYCL_SPAN_INLINE_VISIBILITY constexpr size_type size() const noexcept {
544  return __size;
545  }
546  _SYCL_SPAN_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept {
547  return __size * sizeof(element_type);
548  }
549  _SYCL_SPAN_INLINE_VISIBILITY constexpr bool empty() const noexcept {
550  return __size == 0;
551  }
552 
554  operator[](size_type __idx) const noexcept {
555  _SYCL_SPAN_ASSERT(__idx < size(), "span<T>[] index out of bounds");
556  return __data[__idx];
557  }
558 
559  _SYCL_SPAN_INLINE_VISIBILITY constexpr reference front() const noexcept {
560  _SYCL_SPAN_ASSERT(!empty(), "span<T>[].front() on empty span");
561  return __data[0];
562  }
563 
564  _SYCL_SPAN_INLINE_VISIBILITY constexpr reference back() const noexcept {
565  _SYCL_SPAN_ASSERT(!empty(), "span<T>[].back() on empty span");
566  return __data[size() - 1];
567  }
568 
569  _SYCL_SPAN_INLINE_VISIBILITY constexpr pointer data() const noexcept {
570  return __data;
571  }
572 
573  // [span.iter], span iterator support
574  _SYCL_SPAN_INLINE_VISIBILITY constexpr iterator begin() const noexcept {
575  return iterator(data());
576  }
577  _SYCL_SPAN_INLINE_VISIBILITY constexpr iterator end() const noexcept {
578  return iterator(data() + size());
579  }
580  _SYCL_SPAN_INLINE_VISIBILITY constexpr rev_iterator rbegin() const noexcept {
581  return rev_iterator(end());
582  }
583  _SYCL_SPAN_INLINE_VISIBILITY constexpr rev_iterator rend() const noexcept {
584  return rev_iterator(begin());
585  }
586 
588  __as_bytes() const noexcept {
589  return {reinterpret_cast<const byte *>(data()), size_bytes()};
590  }
591 
593  __as_writable_bytes() const noexcept {
594  return {reinterpret_cast<byte *>(data()), size_bytes()};
595  }
596 
597 private:
598  pointer __data;
599  size_type __size;
600 };
601 
602 // as_bytes & as_writable_bytes
603 template <class _Tp, size_t _Extent>
605  -> decltype(__s.__as_bytes()) {
606  return __s.__as_bytes();
607 }
608 
609 template <class _Tp, size_t _Extent>
612  -> std::enable_if_t<!std::is_const_v<_Tp>,
613  decltype(__s.__as_writable_bytes())> {
614  return __s.__as_writable_bytes();
615 }
616 
617 // Deduction guides
618 
619 // array arg deduction guide
620 template <class _Tp, size_t _Sz>
621 span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
622 
623 template <class _Tp, size_t _Sz> span(std::array<_Tp, _Sz> &) -> span<_Tp, _Sz>;
624 
625 template <class _Tp, size_t _Sz>
626 span(const std::array<_Tp, _Sz> &) -> span<const _Tp, _Sz>;
627 
628 template <class _Container>
629 span(_Container &) -> span<typename _Container::value_type>;
630 
631 template <class _Container>
632 span(const _Container &) -> span<const typename _Container::value_type>;
633 
634 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
635 } // namespace sycl
636 
637 #endif // _SYCL_SPAN
sycl::_V1::span::size_type
size_t size_type
Definition: sycl_span.hpp:199
sycl::_V1::span< _Tp, dynamic_extent >::subspan
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > subspan() const noexcept
Definition: sycl_span.hpp:519
sycl::_V1::span::rbegin
constexpr _SYCL_SPAN_INLINE_VISIBILITY rev_iterator rbegin() const noexcept
Definition: sycl_span.hpp:387
sycl::_V1::span::const_pointer
const _Tp * const_pointer
Definition: sycl_span.hpp:202
sycl::_V1::span::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(const std::array< _OtherElementType, _Extent > &__arr) noexcept
Definition: sycl_span.hpp:254
sycl::_V1::__is_std_array_impl
Definition: sycl_span.hpp:161
sycl::_V1::span::value_type
std::remove_cv_t< _Tp > value_type
Definition: sycl_span.hpp:198
sycl::_V1::span::last
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > last() const noexcept
Definition: sycl_span.hpp:298
sycl::_V1::span< _Tp, dynamic_extent >::first
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > first() const noexcept
Definition: sycl_span.hpp:489
sycl::_V1::span< _Tp, dynamic_extent >::span
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:463
sycl::_V1::span::subspan
constexpr _SYCL_SPAN_INLINE_VISIBILITY auto subspan() const noexcept -> span< element_type,(_Count !=dynamic_extent ? _Count :_Extent - _Offset)>
Definition: sycl_span.hpp:320
sycl::_V1::span< _Tp, dynamic_extent >::last
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, dynamic_extent > last(size_type __count) const noexcept
Definition: sycl_span.hpp:511
sycl::_V1::span< _Tp, dynamic_extent >::iterator
pointer iterator
Definition: sycl_span.hpp:423
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
_SYCL_SPAN_ASSERT
#define _SYCL_SPAN_ASSERT(x, m)
Definition: sycl_span.hpp:147
sycl::_V1::span::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(pointer __ptr, size_type __count)
Definition: sycl_span.hpp:227
sycl::_V1::span< _Tp, dynamic_extent >::pointer
_Tp * pointer
Definition: sycl_span.hpp:419
sycl::_V1::span< _Tp, dynamic_extent >::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(std::array< _OtherElementType, _Sz > &__arr) noexcept
Definition: sycl_span.hpp:449
sycl::_V1::span< _Tp, dynamic_extent >::empty
constexpr _SYCL_SPAN_INLINE_VISIBILITY bool empty() const noexcept
Definition: sycl_span.hpp:549
sycl::_V1::span
span(const _Container &) -> span< const typename _Container::value_type >
sycl::_V1::span::size_bytes
constexpr _SYCL_SPAN_INLINE_VISIBILITY size_type size_bytes() const noexcept
Definition: sycl_span.hpp:353
sycl::_V1::span< _Tp, dynamic_extent >::data
constexpr _SYCL_SPAN_INLINE_VISIBILITY pointer data() const noexcept
Definition: sycl_span.hpp:569
sycl::_V1::span< _Tp, dynamic_extent >::last
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > last() const noexcept
Definition: sycl_span.hpp:496
sycl::_V1::span
Definition: sycl_span.hpp:151
sycl::_V1::span< _Tp, dynamic_extent >::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(pointer __f, pointer __l)
Definition: sycl_span.hpp:437
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::span::operator[]
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference operator[](size_type __idx) const noexcept
Definition: sycl_span.hpp:361
sycl::_V1::dynamic_extent
constexpr size_t dynamic_extent
Definition: sycl_span.hpp:150
sycl::_V1::span< _Tp, dynamic_extent >::size
constexpr _SYCL_SPAN_INLINE_VISIBILITY size_type size() const noexcept
Definition: sycl_span.hpp:543
sycl::_V1::span< _Tp, dynamic_extent >::end
constexpr _SYCL_SPAN_INLINE_VISIBILITY iterator end() const noexcept
Definition: sycl_span.hpp:577
sycl::_V1::span::size
constexpr _SYCL_SPAN_INLINE_VISIBILITY size_type size() const noexcept
Definition: sycl_span.hpp:350
sycl::_V1::span< _Tp, dynamic_extent >::const_pointer
const _Tp * const_pointer
Definition: sycl_span.hpp:420
sycl::_V1::span::__as_writable_bytes
_SYCL_SPAN_INLINE_VISIBILITY span< byte, _Extent *sizeof(element_type)> __as_writable_bytes() const noexcept
Definition: sycl_span.hpp:401
sycl::_V1::detail::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition: stl_type_traits.hpp:24
sycl::_V1::span< _Tp, dynamic_extent >::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(pointer __ptr, size_type __count)
Definition: sycl_span.hpp:435
sycl::_V1::span< _Tp, dynamic_extent >::size_bytes
constexpr _SYCL_SPAN_INLINE_VISIBILITY size_type size_bytes() const noexcept
Definition: sycl_span.hpp:546
sycl::_V1::span::rend
constexpr _SYCL_SPAN_INLINE_VISIBILITY rev_iterator rend() const noexcept
Definition: sycl_span.hpp:390
sycl::_V1::span< _Tp, dynamic_extent >::back
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference back() const noexcept
Definition: sycl_span.hpp:564
sycl::_V1::span< _Tp, dynamic_extent >::size_type
size_t size_type
Definition: sycl_span.hpp:417
sycl::_V1::span< _Tp, dynamic_extent >::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(element_type(&__arr)[_Sz]) noexcept
Definition: sycl_span.hpp:441
sycl::_V1::span< _Tp, dynamic_extent >::operator[]
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference operator[](size_type __idx) const noexcept
Definition: sycl_span.hpp:554
sycl::_V1::span::span
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:259
sycl::_V1::span< _Tp, dynamic_extent >::rev_iterator
std::reverse_iterator< pointer > rev_iterator
Definition: sycl_span.hpp:424
sycl::_V1::span::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(element_type(&__arr)[_Sz])
Definition: sycl_span.hpp:219
sycl::_V1::span::first
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, _Count > first() const noexcept
Definition: sycl_span.hpp:291
sycl::_V1::span::const_reference
const _Tp & const_reference
Definition: sycl_span.hpp:204
sycl::_V1::span::begin
constexpr _SYCL_SPAN_INLINE_VISIBILITY iterator begin() const noexcept
Definition: sycl_span.hpp:381
sycl::_V1::__is_span
Definition: sycl_span.hpp:159
sycl::_V1::ext::oneapi::experimental::operator=
annotated_arg & operator=(annotated_arg &)=default
sycl::_V1::span< _Tp, dynamic_extent >::first
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, dynamic_extent > first(size_type __count) const noexcept
Definition: sycl_span.hpp:503
sycl::_V1::__is_span_impl
Definition: sycl_span.hpp:153
sycl::_V1::span< _Tp, dynamic_extent >::begin
constexpr _SYCL_SPAN_INLINE_VISIBILITY iterator begin() const noexcept
Definition: sycl_span.hpp:574
sycl::_V1::span< _Tp, dynamic_extent >::difference_type
ptrdiff_t difference_type
Definition: sycl_span.hpp:418
sycl::_V1::span< _Tp, dynamic_extent >::rend
constexpr _SYCL_SPAN_INLINE_VISIBILITY rev_iterator rend() const noexcept
Definition: sycl_span.hpp:583
sycl::_V1::span< _Tp, dynamic_extent >::value_type
std::remove_cv_t< _Tp > value_type
Definition: sycl_span.hpp:416
sycl::_V1::span::back
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference back() const noexcept
Definition: sycl_span.hpp:371
sycl::_V1::span< _Tp, dynamic_extent >::__as_writable_bytes
_SYCL_SPAN_INLINE_VISIBILITY span< byte, dynamic_extent > __as_writable_bytes() const noexcept
Definition: sycl_span.hpp:593
sycl::_V1::span< _Tp, dynamic_extent >::front
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference front() const noexcept
Definition: sycl_span.hpp:559
sycl::_V1::__is_std_array
Definition: sycl_span.hpp:167
sycl::_V1::span< _Tp, dynamic_extent >::rbegin
constexpr _SYCL_SPAN_INLINE_VISIBILITY rev_iterator rbegin() const noexcept
Definition: sycl_span.hpp:580
sycl::_V1::span< _Tp, dynamic_extent >::span
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:470
sycl::_V1::span< _Tp, dynamic_extent >::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(const std::array< _OtherElementType, _Sz > &__arr) noexcept
Definition: sycl_span.hpp:458
sycl::_V1::span::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(std::array< _OtherElementType, _Extent > &__arr) noexcept
Definition: sycl_span.hpp:245
sycl::_V1::span::first
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, dynamic_extent > first(size_type __count) const noexcept
Definition: sycl_span.hpp:305
sycl::_V1::span< _Tp, dynamic_extent >::reference
_Tp & reference
Definition: sycl_span.hpp:421
sycl::_V1::span::rev_iterator
std::reverse_iterator< pointer > rev_iterator
Definition: sycl_span.hpp:206
sycl::_V1::span::pointer
_Tp * pointer
Definition: sycl_span.hpp:201
_SYCL_SPAN_INLINE_VISIBILITY
#define _SYCL_SPAN_INLINE_VISIBILITY
Definition: sycl_span.hpp:134
sycl::_V1::span::iterator
pointer iterator
Definition: sycl_span.hpp:205
sycl::_V1::span::span
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:269
sycl::_V1::span::data
constexpr _SYCL_SPAN_INLINE_VISIBILITY pointer data() const noexcept
Definition: sycl_span.hpp:376
sycl::_V1::span::front
constexpr _SYCL_SPAN_INLINE_VISIBILITY reference front() const noexcept
Definition: sycl_span.hpp:366
sycl::_V1::span< _Tp, dynamic_extent >::subspan
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:529
sycl::_V1::span::span
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:280
sycl::_V1::span::subspan
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:336
sycl::_V1::span< _Tp, dynamic_extent >::const_reference
const _Tp & const_reference
Definition: sycl_span.hpp:422
std
Definition: accessor.hpp:3230
sycl::_V1::span::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span() noexcept
Definition: sycl_span.hpp:213
sycl::_V1::span::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span(pointer __f, pointer __l)
Definition: sycl_span.hpp:234
sycl::_V1::span::end
constexpr _SYCL_SPAN_INLINE_VISIBILITY iterator end() const noexcept
Definition: sycl_span.hpp:384
sycl::_V1::span::reference
_Tp & reference
Definition: sycl_span.hpp:203
sycl::_V1::span::__as_bytes
_SYCL_SPAN_INLINE_VISIBILITY span< const byte, _Extent *sizeof(element_type)> __as_bytes() const noexcept
Definition: sycl_span.hpp:395
sycl::_V1::span::last
constexpr _SYCL_SPAN_INLINE_VISIBILITY span< element_type, dynamic_extent > last(size_type __count) const noexcept
Definition: sycl_span.hpp:313
sycl::_V1::as_bytes
_SYCL_SPAN_INLINE_VISIBILITY auto as_bytes(span< _Tp, _Extent > __s) noexcept -> decltype(__s.__as_bytes())
Definition: sycl_span.hpp:604
sycl::_V1::span< _Tp, dynamic_extent >::__as_bytes
_SYCL_SPAN_INLINE_VISIBILITY span< const byte, dynamic_extent > __as_bytes() const noexcept
Definition: sycl_span.hpp:588
sycl::_V1::span::element_type
_Tp element_type
Definition: sycl_span.hpp:197
sycl::_V1::__is_span_compatible_container
Definition: sycl_span.hpp:170
sycl::_V1::span< _Tp, dynamic_extent >::span
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:478
sycl::_V1::span< _Tp, dynamic_extent >::element_type
_Tp element_type
Definition: sycl_span.hpp:415
sycl::_V1::as_writable_bytes
_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:611
_SYCL_SPAN_TEMPLATE_VIS
#define _SYCL_SPAN_TEMPLATE_VIS
Definition: sycl_span.hpp:133
sycl::_V1::ext::oneapi::experimental::reference
sycl::ext::oneapi::experimental::annotated_ref< T, property_list_t > reference
Definition: annotated_ptr.hpp:101
sycl::_V1::span< _Tp, dynamic_extent >::span
constexpr _SYCL_SPAN_INLINE_VISIBILITY span() noexcept
Definition: sycl_span.hpp:429
sycl::_V1::span::difference_type
ptrdiff_t difference_type
Definition: sycl_span.hpp:200
sycl::_V1::ext::intel::experimental::byte
unsigned char byte
Definition: online_compiler.hpp:22
sycl::_V1::detail::void_t
void void_t
Definition: stl_type_traits.hpp:42
sycl::_V1::span::empty
constexpr _SYCL_SPAN_INLINE_VISIBILITY bool empty() const noexcept
Definition: sycl_span.hpp:356