Lines Matching refs:span
2 //===------------------------------ span ---------------------------------===//
15 span synopsis
22 // [views.span], class template span
24 class span;
26 // [span.objectrep], views of object representation
28 span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :
29 …(static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_bytes(span<ElementType, Extent> s) noe…
32 span< byte, ((Extent == dynamic_extent) ? dynamic_extent :
33 …(static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_writable_bytes(span<ElementType, Exten…
38 class span {
53 // [span.cons], span constructors, copy, assignment, and destructor
54 constexpr span() noexcept;
55 constexpr span(pointer ptr, index_type count);
56 constexpr span(pointer firstElem, pointer lastElem);
58 constexpr span(element_type (&arr)[N]) noexcept;
60 constexpr span(array<value_type, N>& arr) noexcept;
62 constexpr span(const array<value_type, N>& arr) noexcept;
64 constexpr span(Container& cont);
66 constexpr span(const Container& cont);
67 constexpr span(const span& other) noexcept = default;
69 constexpr span(const span<OtherElementType, OtherExtent>& s) noexcept;
70 ~span() noexcept = default;
71 constexpr span& operator=(const span& other) noexcept = default;
73 // [span.sub], span subviews
75 constexpr span<element_type, Count> first() const;
77 constexpr span<element_type, Count> last() const;
79 constexpr span<element_type, see below> subspan() const;
81 constexpr span<element_type, dynamic_extent> first(index_type count) const;
82 constexpr span<element_type, dynamic_extent> last(index_type count) const;
83 …constexpr span<element_type, dynamic_extent> subspan(index_type offset, index_type count = dynamic…
85 // [span.obs], span observers
90 // [span.elem], span element access
95 // [span.iterators], span iterator support
111 span(T (&)[N]) -> span<T, N>;
114 span(array<T, N>&) -> span<T, N>;
117 span(const array<T, N>&) -> span<const T, N>;
120 span(Container&) -> span<typename Container::value_type>;
123 span(const Container&) -> span<const typename Container::value_type>;
145 template <typename _Tp, ptrdiff_t _Extent = dynamic_extent> class span;
152 struct __is_span_impl<span<_Tp, _Extent>> : public true_type {};
172 // is not a specialization of span
191 class _LIBCPP_TEMPLATE_VIS span {
208 static_assert (_Extent >= 0, "Can't have a span with an extent < 0");
210 // [span.cons], span constructors, copy, assignment, and destructor
211 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}
212 … { static_assert(_Extent == 0, "Can't default construct a statically sized span with size > 0"); }
214 constexpr span (const span&) noexcept = default;
215 constexpr span& operator=(const span&) noexcept = default;
217 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}
218 …{ (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len…
219 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}
220 …{ (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructo…
222 …_LIBCPP_INLINE_VISIBILITY constexpr span(element_type (&__arr)[_Extent]) noexcept : __dat…
223 …_LIBCPP_INLINE_VISIBILITY constexpr span( array<value_type, _Extent>& __arr) noexcept : __dat…
224 …_LIBCPP_INLINE_VISIBILITY constexpr span(const array<value_type, _Extent>& __arr) noexcept : __dat…
228 constexpr span( _Container& __c,
231 …{ _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container)"); }
235 constexpr span(const _Container& __c,
238 …{ _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (const containe…
242 constexpr span(const span<_OtherElementType, _Extent>& __other,
250 constexpr span(const span<_OtherElementType, dynamic_extent>& __other,
254 … { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); }
257 // ~span() noexcept = default;
261 constexpr span<element_type, _Count> first() const noexcept
263 static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
264 static_assert(_Count <= _Extent, "Count out of range in span::first()");
270 constexpr span<element_type, _Count> last() const noexcept
272 static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
273 static_assert(_Count <= _Extent, "Count out of range in span::last()");
278 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
280 … _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::first(count)");
285 constexpr span<element_type, dynamic_extent> last(index_type __count) const noexcept
287 … _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::last(count)");
294 -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
296 _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");
302 constexpr span<element_type, dynamic_extent>
305 …_LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset,…
306 … __count <= size()) || __count == dynamic_extent, "Count out of range in span::subspan(offset, co…
309 …_LIBCPP_ASSERT(__offset + __count <= size(), "count + offset out of range in span::subspan(offset,…
319 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>[] index out of bounds");
325 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>() index out of bounds");
331 // [span.iter], span iterator support
341 _LIBCPP_INLINE_VISIBILITY constexpr void swap(span &__other) noexcept
348 …_LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noex…
351 …_LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writeable_bytes() const …
361 class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> {
381 // [span.cons], span constructors, copy, assignment, and destructor
382 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {}
384 constexpr span (const span&) noexcept = default;
385 constexpr span& operator=(const span&) noexcept = default;
387 …_LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}, __siz…
388 …_LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{distance(…
392 constexpr span(element_type (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}
396 …constexpr span(array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
400 …constexpr span(const array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
404 constexpr span( _Container& __c,
410 constexpr span(const _Container& __c,
417 constexpr span(const span<_OtherElementType, _OtherExtent>& __other,
423 // ~span() noexcept = default;
427 constexpr span<element_type, _Count> first() const noexcept
429 static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
430 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()");
436 constexpr span<element_type, _Count> last() const noexcept
438 static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
439 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()");
444 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
446 … _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::first(count)");
451 constexpr span<element_type, dynamic_extent> last (index_type __count) const noexcept
453 … _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::last(count)");
459 constexpr span<_Tp, dynamic_extent> subspan() const noexcept
461 _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");
462 …T(_Count == dynamic_extent || _Offset + _Count <= size(), "Count out of range in span::subspan()");
466 constexpr span<element_type, dynamic_extent>
470 …_LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset,…
471 … __count <= size()) || __count == dynamic_extent, "count out of range in span::subspan(offset, co…
474 …_LIBCPP_ASSERT(__offset + __count <= size(), "Offset + count out of range in span::subspan(offset,…
484 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>[] index out of bounds");
490 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>() index out of bounds");
496 // [span.iter], span iterator support
506 _LIBCPP_INLINE_VISIBILITY constexpr void swap(span &__other) noexcept
517 _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept
520 _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writeable_bytes() const noexcept
530 auto as_bytes(span<_Tp, _Extent> __s) noexcept
535 auto as_writeable_bytes(span<_Tp, _Extent> __s) noexcept
540 constexpr void swap(span<_Tp, _Extent> &__lhs, span<_Tp, _Extent> &__rhs) noexcept
546 span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
549 span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
552 span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
555 span(_Container&) -> span<typename _Container::value_type>;
558 span(const _Container&) -> span<const typename _Container::value_type>;