Lines Matching refs:span

2 //===------------------------------ span ---------------------------------===//
14 span synopsis
21 // [views.span], class template span
23 class span;
26 inline constexpr bool ranges::enable_view<span<ElementType, Extent>> = true;
29 inline constexpr bool ranges::enable_borrowed_range<span<ElementType, Extent>> = true;
31 // [span.objectrep], views of object representation
33 span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :
34 (sizeof(ElementType) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;
37 span< byte, ((Extent == dynamic_extent) ? dynamic_extent :
38 (sizeof(ElementType) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;
42 class span {
57 // [span.cons], span constructors, copy, assignment, and destructor
58 constexpr span() noexcept;
59 constexpr explicit(Extent != dynamic_extent) span(pointer ptr, size_type count);
60 constexpr explicit(Extent != dynamic_extent) span(pointer firstElem, pointer lastElem);
62 constexpr span(element_type (&arr)[N]) noexcept;
64 constexpr span(array<value_type, N>& arr) noexcept;
66 constexpr span(const array<value_type, N>& arr) noexcept;
68 constexpr explicit(Extent != dynamic_extent) span(Container& cont);
70 constexpr explicit(Extent != dynamic_extent) span(const Container& cont);
71 constexpr span(const span& other) noexcept = default;
73 …constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) no…
74 ~span() noexcept = default;
75 constexpr span& operator=(const span& other) noexcept = default;
77 // [span.sub], span subviews
79 constexpr span<element_type, Count> first() const;
81 constexpr span<element_type, Count> last() const;
83 constexpr span<element_type, see below> subspan() const;
85 constexpr span<element_type, dynamic_extent> first(size_type count) const;
86 constexpr span<element_type, dynamic_extent> last(size_type count) const;
87 …constexpr span<element_type, dynamic_extent> subspan(size_type offset, size_type count = dynamic_e…
89 // [span.obs], span observers
94 // [span.elem], span element access
100 // [span.iterators], span iterator support
112 span(T (&)[N]) -> span<T, N>;
115 span(array<T, N>&) -> span<T, N>;
118 span(const array<T, N>&) -> span<const T, N>;
121 span(Container&) -> span<typename Container::value_type>;
124 span(const Container&) -> span<const typename Container::value_type>;
154 template <typename _Tp, size_t _Extent = dynamic_extent> class span;
161 struct __is_span_impl<span<_Tp, _Extent>> : public true_type {};
181 // is not a specialization of span
200 class _LIBCPP_TEMPLATE_VIS span {
220 // [span.cons], span constructors, copy, assignment, and destructor
222 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {}
224 constexpr span (const span&) noexcept = default;
225 constexpr span& operator=(const span&) noexcept = default;
227 …_LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __ptr, size_type __count) : __data{__ptr}
228 …{ (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len…
229 _LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __f, pointer __l) : __data{__f}
230 …{ (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructo…
232 …_LIBCPP_INLINE_VISIBILITY constexpr span(element_type (&__arr)[_Extent]) noexcept : __dat…
237 constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {}
242 … constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {}
246 constexpr explicit span( _Container& __c,
249 … _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)");
254 constexpr explicit span(const _Container& __c,
257 … _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)");
262 constexpr span(const span<_OtherElementType, _Extent>& __other,
270 constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other,
274 … { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); }
277 // ~span() noexcept = default;
281 constexpr span<element_type, _Count> first() const noexcept
283 static_assert(_Count <= _Extent, "Count out of range in span::first()");
284 return span<element_type, _Count>{data(), _Count};
289 constexpr span<element_type, _Count> last() const noexcept
291 static_assert(_Count <= _Extent, "Count out of range in span::last()");
292 return span<element_type, _Count>{data() + size() - _Count, _Count};
296 constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
298 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
303 constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept
305 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
312 -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
314 static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()");
315 …= dynamic_extent || _Count <= _Extent - _Offset, "Offset + count out of range in span::subspan()");
317 … using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
323 constexpr span<element_type, dynamic_extent>
326 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
327 …_LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subsp…
330 …_LIBCPP_ASSERT(__count <= size() - __offset, "Offset + count out of range in span::subspan(offset,…
340 _LIBCPP_ASSERT(__idx < size(), "span<T,N>[] index out of bounds");
346 _LIBCPP_ASSERT(!empty(), "span<T, N>::front() on empty span");
352 _LIBCPP_ASSERT(!empty(), "span<T, N>::back() on empty span");
358 // [span.iter], span iterator support
364 …_LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noex…
365 …{ return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte *>(data()), …
367 …_LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const n…
368 …{ return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte *>(data()), size_bytes()…
377 class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> {
399 // [span.cons], span constructors, copy, assignment, and destructor
400 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {}
402 constexpr span (const span&) noexcept = default;
403 constexpr span& operator=(const span&) noexcept = default;
405 …_LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}, __size…
406 …_LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_ca…
410 constexpr span(element_type (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}
415 …constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} …
420 …constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size…
424 constexpr span( _Container& __c,
430 constexpr span(const _Container& __c,
437 constexpr span(const span<_OtherElementType, _OtherExtent>& __other,
443 // ~span() noexcept = default;
447 constexpr span<element_type, _Count> first() const noexcept
449 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()");
450 return span<element_type, _Count>{data(), _Count};
455 constexpr span<element_type, _Count> last() const noexcept
457 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()");
458 return span<element_type, _Count>{data() + size() - _Count, _Count};
462 constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
464 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
469 constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept
471 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
477 constexpr span<element_type, _Count> subspan() const noexcept
479 _LIBCPP_ASSERT(_Offset <= size(), "Offset out of range in span::subspan()");
480 …== dynamic_extent || _Count <= size() - _Offset, "Offset + count out of range in span::subspan()");
481 …return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : …
484 constexpr span<element_type, dynamic_extent>
488 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
489 …_LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subsp…
492 …_LIBCPP_ASSERT(__count <= size() - __offset, "Offset + count out of range in span::subspan(offset,…
502 _LIBCPP_ASSERT(__idx < size(), "span<T>[] index out of bounds");
508 _LIBCPP_ASSERT(!empty(), "span<T>[].front() on empty span");
514 _LIBCPP_ASSERT(!empty(), "span<T>[].back() on empty span");
521 // [span.iter], span iterator support
527 _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept
530 _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept
540 inline constexpr bool ranges::enable_borrowed_range<span<_Tp, _Extent> > = true;
543 inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true;
549 auto as_bytes(span<_Tp, _Extent> __s) noexcept
555 auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept
561 span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
564 span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
567 span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
570 span(_Container&) -> span<typename _Container::value_type>;
573 span(const _Container&) -> span<const typename _Container::value_type>;