Lines Matching refs: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;
60 constexpr explicit(Extent != dynamic_extent) span(It first, size_type count);
62 constexpr explicit(Extent != dynamic_extent) span(It first, End last);
64 constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept;
66 constexpr span(array<value_type, N>& arr) noexcept;
68 constexpr span(const array<value_type, N>& arr) noexcept;
70 constexpr explicit(Extent != dynamic_extent) span(R&& r);
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(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
115 span(T (&)[N]) -> span<T, N>;
118 span(array<T, N>&) -> span<T, N>;
121 span(const array<T, N>&) -> span<const T, N>;
124 span(R&&) -> span<remove_reference_t<ranges::range_reference_t<R>>>;
133 #include <__fwd/span.h>
181 struct __is_std_span<span<_Tp, _Sz>> : true_type {};
203 class _LIBCPP_TEMPLATE_VIS span {
223 // [span.cons], span constructors, copy, assignment, and destructor
225 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data_{nullptr} {}
227 constexpr span (const span&) noexcept = default;
228 constexpr span& operator=(const span&) noexcept = default;
232 constexpr explicit span(_It __first, size_type __count)
235 _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (iterator, len)");
240 constexpr explicit span(_It __first, _End __last) : __data_{_VSTD::to_address(__first)} {
242 …_LIBCPP_ASSERT((__last - __first >= 0), "invalid range in span's constructor (iterator, sentinel)"…
244 … "invalid range in span's constructor (iterator, sentinel): last - first != extent");
247 …_LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept…
251 constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
256 … constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
260 constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} {
261 _LIBCPP_ASSERT(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)");
266 constexpr span(const span<_OtherElementType, _Extent>& __other)
271 constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other) noexcept
272 … { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); }
275 // ~span() noexcept = default;
279 constexpr span<element_type, _Count> first() const noexcept
281 static_assert(_Count <= _Extent, "span<T, N>::first<Count>(): Count out of range");
282 return span<element_type, _Count>{data(), _Count};
287 constexpr span<element_type, _Count> last() const noexcept
289 static_assert(_Count <= _Extent, "span<T, N>::last<Count>(): Count out of range");
290 return span<element_type, _Count>{data() + size() - _Count, _Count};
294 constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
296 _LIBCPP_ASSERT(__count <= size(), "span<T, N>::first(count): count out of range");
301 constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept
303 _LIBCPP_ASSERT(__count <= size(), "span<T, N>::last(count): count out of range");
310 -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
312 … static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
313 …static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset, "span<T, N>::subspan<Offset…
315 … using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
321 constexpr span<element_type, dynamic_extent>
324 … _LIBCPP_ASSERT(__offset <= size(), "span<T, N>::subspan(offset, count): offset out of range");
325 …_LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "span<T, N>::subspan(offset, count…
328 …_LIBCPP_ASSERT(__count <= size() - __offset, "span<T, N>::subspan(offset, count): offset + count o…
338 _LIBCPP_ASSERT(__idx < size(), "span<T, N>::operator[](index): index out of range");
344 _LIBCPP_ASSERT(!empty(), "span<T, N>::front() on empty span");
350 _LIBCPP_ASSERT(!empty(), "span<T, N>::back() on empty span");
356 // [span.iter], span iterator support
374 …_LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noex…
375 …{ return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte *>(data()), …
377 …_LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const n…
378 …{ return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte *>(data()), size_bytes()…
386 class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> {
406 // [span.cons], span constructors, copy, assignment, and destructor
407 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
409 constexpr span (const span&) noexcept = default;
410 constexpr span& operator=(const span&) noexcept = default;
414 constexpr span(_It __first, size_type __count)
418 _LIBCPP_INLINE_VISIBILITY constexpr span(_It __first, _End __last)
420 … _LIBCPP_ASSERT(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)");
425 …constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept : __data_{__arr}, __size_{_Sz…
429 …constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data_{__arr.data()}, __size_{_Sz…
434 …constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data_{__arr.data()}, __siz…
438 constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::size(__r)} {}
442 constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept
445 // ~span() noexcept = default;
449 constexpr span<element_type, _Count> first() const noexcept
451 _LIBCPP_ASSERT(_Count <= size(), "span<T>::first<Count>(): Count out of range");
452 return span<element_type, _Count>{data(), _Count};
457 constexpr span<element_type, _Count> last() const noexcept
459 _LIBCPP_ASSERT(_Count <= size(), "span<T>::last<Count>(): Count out of range");
460 return span<element_type, _Count>{data() + size() - _Count, _Count};
464 constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
466 _LIBCPP_ASSERT(__count <= size(), "span<T>::first(count): count out of range");
471 constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept
473 _LIBCPP_ASSERT(__count <= size(), "span<T>::last(count): count out of range");
479 constexpr span<element_type, _Count> subspan() const noexcept
481 _LIBCPP_ASSERT(_Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset out of range");
482 …_LIBCPP_ASSERT(_Count == dynamic_extent || _Count <= size() - _Offset, "span<T>::subspan<Offset, C…
483 …return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : …
486 constexpr span<element_type, dynamic_extent>
490 _LIBCPP_ASSERT(__offset <= size(), "span<T>::subspan(offset, count): offset out of range");
491 …_LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "span<T>::subspan(offset, count): c…
494 …_LIBCPP_ASSERT(__count <= size() - __offset, "span<T>::subspan(offset, count): offset + count out …
504 _LIBCPP_ASSERT(__idx < size(), "span<T>::operator[](index): index out of range");
510 _LIBCPP_ASSERT(!empty(), "span<T>::front() on empty span");
516 _LIBCPP_ASSERT(!empty(), "span<T>::back() on empty span");
523 // [span.iter], span iterator support
541 _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept
544 _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept
553 inline constexpr bool ranges::enable_borrowed_range<span<_Tp, _Extent> > = true;
556 inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true;
561 auto as_bytes(span<_Tp, _Extent> __s) noexcept
566 auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept
571 span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
575 span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
578 span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
581 span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
584 span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;