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 explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il); // Since …
72 constexpr span(const span& other) noexcept = default;
74 …constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) no…
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
101 // [span.iterators], span iterator support
113 span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
116 span(T (&)[N]) -> span<T, N>;
119 span(array<T, N>&) -> span<T, N>;
122 span(const array<T, N>&) -> span<const T, N>;
125 span(R&&) -> span<remove_reference_t<ranges::range_reference_t<R>>>;
133 #include <__fwd/span.h>
184 struct __is_std_span<span<_Tp, _Sz>> : true_type {};
207 class _LIBCPP_TEMPLATE_VIS span {
227 // [span.cons], span constructors, copy, assignment, and destructor
230 _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
233 _LIBCPP_HIDE_FROM_ABI constexpr explicit span(std::initializer_list<value_type> __il)
237 _Extent == __il.size(), "Size mismatch in span's constructor _Extent != __il.size().");
241 constexpr span(const span&) noexcept = default;
242 constexpr span& operator=(const span&) noexcept = default;
245 …_LIBCPP_HIDE_FROM_ABI constexpr explicit span(_It __first, size_type __count) : __data_{std::to_ad…
247 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __count, "size mismatch in span's constructor (iter…
251 …_LIBCPP_HIDE_FROM_ABI constexpr explicit span(_It __first, _End __last) : __data_{std::to_address(…
252 // [span.cons]/10
255 …_LIBCPP_ASSERT_VALID_INPUT_RANGE(__dist >= 0, "invalid range in span's constructor (iterator, sent…
257 …__dist == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != exte…
260 …_LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : _…
263 …_LIBCPP_HIDE_FROM_ABI constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data_{…
267 _LIBCPP_HIDE_FROM_ABI constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept
271 _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} {
272 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(ranges::size(__r) == _Extent, "size mismatch in span's constru…
276 …_LIBCPP_HIDE_FROM_ABI constexpr span(const span<_OtherElementType, _Extent>& __other) : __data_{__…
279 …_LIBCPP_HIDE_FROM_ABI constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __oth…
281 …ALID_ELEMENT_ACCESS(_Extent == __other.size(), "size mismatch in span's constructor (other span)");
285 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
286 static_assert(_Count <= _Extent, "span<T, N>::first<Count>(): Count out of range");
287 return span<element_type, _Count>{data(), _Count};
291 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
292 static_assert(_Count <= _Extent, "span<T, N>::last<Count>(): Count out of range");
293 return span<element_type, _Count>{data() + size() - _Count, _Count};
296 …_LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const …
297 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::first(count): count out of ran…
301 …_LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const n…
302 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::last(count): count out of rang…
308 -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
309 static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
311 "span<T, N>::subspan<Offset, Count>(): Offset + Count out of range");
313 using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
317 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
319 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T, N>::subspan(offset, count): offse…
323 … __count <= size() - __offset, "span<T, N>::subspan(offset, count): offset + count out of range");
332 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T, N>::operator[](index): index out of r…
339 std::__throw_out_of_range("span");
345 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::front() on empty span");
350 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::back() on empty span");
356 // [span.iter], span iterator support
374 …_LIBCPP_HIDE_FROM_ABI span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept…
375 …return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte*>(data()), siz…
378 …_LIBCPP_HIDE_FROM_ABI span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexc…
379 … return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte*>(data()), size_bytes()};
387 class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> {
407 // [span.cons], span constructors, copy, assignment, and destructor
408 _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
411 _LIBCPP_HIDE_FROM_ABI constexpr span(std::initializer_list<value_type> __il)
416 constexpr span(const span&) noexcept = default;
417 constexpr span& operator=(const span&) noexcept = default;
420 _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, size_type __count)
424 _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, _End __last)
426 …_LIBCPP_ASSERT_VALID_INPUT_RANGE(__last - __first >= 0, "invalid range in span's constructor (iter…
430 _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept
434 _LIBCPP_HIDE_FROM_ABI constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept
439 _LIBCPP_HIDE_FROM_ABI constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept
443 …_LIBCPP_HIDE_FROM_ABI constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::s…
446 …_LIBCPP_HIDE_FROM_ABI constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept
450 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
451 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::first<Count>(): Count out of range…
452 return span<element_type, _Count>{data(), _Count};
456 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
457 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::last<Count>(): Count out of range"…
458 return span<element_type, _Count>{data() + size() - _Count, _Count};
461 …_LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const …
462 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::first(count): count out of range"…
466 …_LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const n…
467 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::last(count): count out of range");
472 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> subspan() const noexcept {
473 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset …
475 … "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
476 …return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : …
479 constexpr span<element_type, dynamic_extent> _LIBCPP_HIDE_FROM_ABI
481 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T>::subspan(offset, count): offset o…
485 … __count <= size() - __offset, "span<T>::subspan(offset, count): offset + count out of range");
494 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T>::operator[](index): index out of rang…
501 std::__throw_out_of_range("span");
507 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::front() on empty span");
512 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::back() on empty span");
518 // [span.iter], span iterator support
536 _LIBCPP_HIDE_FROM_ABI span<const byte, dynamic_extent> __as_bytes() const noexcept {
540 _LIBCPP_HIDE_FROM_ABI span<byte, dynamic_extent> __as_writable_bytes() const noexcept {
550 inline constexpr bool ranges::enable_borrowed_range<span<_Tp, _Extent> > = true;
553 inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true;
557 _LIBCPP_HIDE_FROM_ABI auto as_bytes(span<_Tp, _Extent> __s) noexcept {
563 _LIBCPP_HIDE_FROM_ABI auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept {
569 span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
573 span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
576 span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
579 span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
582 span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;