2 //===------------------------------ span ---------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===---------------------------------------------------------------------===//
20 inline constexpr ptrdiff_t dynamic_extent = -1;
22 // [views.span], class template span
23 template <class ElementType, ptrdiff_t Extent = dynamic_extent>
26 // [span.objectrep], views of object representation
27 template <class ElementType, ptrdiff_t Extent>
28 span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :
29 (static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;
31 template <class ElementType, ptrdiff_t Extent>
32 span< byte, ((Extent == dynamic_extent) ? dynamic_extent :
33 (static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;
37 template <class ElementType, ptrdiff_t Extent = dynamic_extent>
40 // constants and types
41 using element_type = ElementType;
42 using value_type = remove_cv_t<ElementType>;
43 using index_type = ptrdiff_t;
44 using difference_type = ptrdiff_t;
45 using pointer = element_type*;
46 using reference = element_type&;
47 using iterator = implementation-defined;
48 using const_iterator = implementation-defined;
49 using reverse_iterator = std::reverse_iterator<iterator>;
50 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
51 static constexpr index_type extent = Extent;
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;
63 template <class Container>
64 constexpr span(Container& cont);
65 template <class Container>
66 constexpr span(const Container& cont);
67 constexpr span(const span& other) noexcept = default;
68 template <class OtherElementType, ptrdiff_t OtherExtent>
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
74 template <ptrdiff_t Count>
75 constexpr span<element_type, Count> first() const;
76 template <ptrdiff_t Count>
77 constexpr span<element_type, Count> last() const;
78 template <ptrdiff_t Offset, ptrdiff_t Count = dynamic_extent>
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_extent) const;
85 // [span.obs], span observers
86 constexpr index_type size() const noexcept;
87 constexpr index_type size_bytes() const noexcept;
88 constexpr bool empty() const noexcept;
90 // [span.elem], span element access
91 constexpr reference operator[](index_type idx) const;
92 constexpr reference operator()(index_type idx) const;
93 constexpr pointer data() const noexcept;
95 // [span.iterators], span iterator support
96 constexpr iterator begin() const noexcept;
97 constexpr iterator end() const noexcept;
98 constexpr const_iterator cbegin() const noexcept;
99 constexpr const_iterator cend() const noexcept;
100 constexpr reverse_iterator rbegin() const noexcept;
101 constexpr reverse_iterator rend() const noexcept;
102 constexpr const_reverse_iterator crbegin() const noexcept;
103 constexpr const_reverse_iterator crend() const noexcept;
106 pointer data_; // exposition only
107 index_type size_; // exposition only
110 template<class T, size_t N>
111 span(T (&)[N]) -> span<T, N>;
113 template<class T, size_t N>
114 span(array<T, N>&) -> span<T, N>;
116 template<class T, size_t N>
117 span(const array<T, N>&) -> span<const T, N>;
119 template<class Container>
120 span(Container&) -> span<typename Container::value_type>;
122 template<class Container>
123 span(const Container&) -> span<const typename Container::value_type>;
130 #include <cstddef> // for ptrdiff_t
131 #include <iterator> // for iterators
132 #include <array> // for array
133 #include <type_traits> // for remove_cv, etc
134 #include <cstddef> // for byte
136 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
137 #pragma GCC system_header
140 _LIBCPP_BEGIN_NAMESPACE_STD
142 #if _LIBCPP_STD_VER > 17
144 inline constexpr ptrdiff_t dynamic_extent = -1;
145 template <typename _Tp, ptrdiff_t _Extent = dynamic_extent> class span;
149 struct __is_span_impl : public false_type {};
151 template <class _Tp, ptrdiff_t _Extent>
152 struct __is_span_impl<span<_Tp, _Extent>> : public true_type {};
155 struct __is_span : public __is_span_impl<remove_cv_t<_Tp>> {};
158 struct __is_std_array_impl : public false_type {};
160 template <class _Tp, size_t _Sz>
161 struct __is_std_array_impl<array<_Tp, _Sz>> : public true_type {};
164 struct __is_std_array : public __is_std_array_impl<remove_cv_t<_Tp>> {};
166 template <class _Tp, class _ElementType, class = void>
167 struct __is_span_compatible_container : public false_type {};
169 template <class _Tp, class _ElementType>
170 struct __is_span_compatible_container<_Tp, _ElementType,
172 // is not a specialization of span
173 typename enable_if<!__is_span<_Tp>::value, nullptr_t>::type,
174 // is not a specialization of array
175 typename enable_if<!__is_std_array<_Tp>::value, nullptr_t>::type,
176 // is_array_v<Container> is false,
177 typename enable_if<!is_array_v<_Tp>, nullptr_t>::type,
178 // data(cont) and size(cont) are well formed
179 decltype(data(declval<_Tp>())),
180 decltype(size(declval<_Tp>())),
181 // remove_pointer_t<decltype(data(cont))>(*)[] is convertible to ElementType(*)[]
183 is_convertible_v<remove_pointer_t<decltype(data(declval<_Tp &>()))>(*)[],
187 : public true_type {};
190 template <typename _Tp, ptrdiff_t _Extent>
191 class _LIBCPP_TEMPLATE_VIS span {
193 // constants and types
194 using element_type = _Tp;
195 using value_type = remove_cv_t<_Tp>;
196 using index_type = ptrdiff_t;
197 using difference_type = ptrdiff_t;
198 using pointer = _Tp *;
199 using const_pointer = const _Tp *; // not in standard
200 using reference = _Tp &;
201 using const_reference = const _Tp &; // not in standard
202 using iterator = __wrap_iter<pointer>;
203 using const_iterator = __wrap_iter<const_pointer>;
204 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
205 using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;
207 static constexpr index_type extent = _Extent;
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 constructor (ptr, ptr)"); }
222 _LIBCPP_INLINE_VISIBILITY constexpr span(element_type (&__arr)[_Extent]) noexcept : __data{__arr} {}
223 _LIBCPP_INLINE_VISIBILITY constexpr span( array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}
224 _LIBCPP_INLINE_VISIBILITY constexpr span(const array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}
226 template <class _Container>
227 inline _LIBCPP_INLINE_VISIBILITY
228 constexpr span( _Container& __c,
229 enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
230 : __data{_VSTD::data(__c)}
231 { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container)"); }
233 template <class _Container>
234 inline _LIBCPP_INLINE_VISIBILITY
235 constexpr span(const _Container& __c,
236 enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
237 : __data{_VSTD::data(__c)}
238 { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (const container)"); }
240 template <class _OtherElementType>
241 inline _LIBCPP_INLINE_VISIBILITY
242 constexpr span(const span<_OtherElementType, _Extent>& __other,
244 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
245 nullptr_t> = nullptr)
246 : __data{__other.data()} {}
248 template <class _OtherElementType>
249 inline _LIBCPP_INLINE_VISIBILITY
250 constexpr span(const span<_OtherElementType, dynamic_extent>& __other,
252 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
253 nullptr_t> = nullptr) noexcept
254 : __data{__other.data()} { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); }
257 // ~span() noexcept = default;
259 template <ptrdiff_t _Count>
260 inline _LIBCPP_INLINE_VISIBILITY
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()");
265 return {data(), _Count};
268 template <ptrdiff_t _Count>
269 inline _LIBCPP_INLINE_VISIBILITY
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()");
274 return {data() + size() - _Count, _Count};
277 _LIBCPP_INLINE_VISIBILITY
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)");
281 return {data(), __count};
284 _LIBCPP_INLINE_VISIBILITY
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)");
288 return {data() + size() - __count, __count};
291 template <ptrdiff_t _Offset, ptrdiff_t _Count = dynamic_extent>
292 inline _LIBCPP_INLINE_VISIBILITY
293 constexpr auto subspan() const noexcept
294 -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
296 _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");
297 return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
301 inline _LIBCPP_INLINE_VISIBILITY
302 constexpr span<element_type, dynamic_extent>
303 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
305 _LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset, count)");
306 _LIBCPP_ASSERT((__count >= 0 && __count <= size()) || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");
307 if (__count == dynamic_extent)
308 return {data() + __offset, size() - __offset};
309 _LIBCPP_ASSERT(__offset + __count <= size(), "count + offset out of range in span::subspan(offset, count)");
310 return {data() + __offset, __count};
313 _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return _Extent; }
314 _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
315 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; }
317 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept
319 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>[] index out of bounds");
320 return __data[__idx];
323 _LIBCPP_INLINE_VISIBILITY constexpr reference operator()(index_type __idx) const noexcept
325 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>() index out of bounds");
326 return __data[__idx];
329 _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }
331 // [span.iter], span iterator support
332 _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); }
333 _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); }
334 _LIBCPP_INLINE_VISIBILITY constexpr const_iterator cbegin() const noexcept { return const_iterator(data()); }
335 _LIBCPP_INLINE_VISIBILITY constexpr const_iterator cend() const noexcept { return const_iterator(data() + size()); }
336 _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
337 _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
338 _LIBCPP_INLINE_VISIBILITY constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); }
339 _LIBCPP_INLINE_VISIBILITY constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
341 _LIBCPP_INLINE_VISIBILITY constexpr void swap(span &__other) noexcept
343 pointer __p = __data;
344 __data = __other.__data;
345 __other.__data = __p;
348 _LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept
349 { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
351 _LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writeable_bytes() const noexcept
352 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
360 template <typename _Tp>
361 class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> {
365 // constants and types
366 using element_type = _Tp;
367 using value_type = remove_cv_t<_Tp>;
368 using index_type = ptrdiff_t;
369 using difference_type = ptrdiff_t;
370 using pointer = _Tp *;
371 using const_pointer = const _Tp *; // not in standard
372 using reference = _Tp &;
373 using const_reference = const _Tp &; // not in standard
374 using iterator = __wrap_iter<pointer>;
375 using const_iterator = __wrap_iter<const_pointer>;
376 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
377 using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;
379 static constexpr index_type extent = 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}, __size{__count} {}
388 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{distance(__f, __l)} {}
390 template <size_t _Sz>
391 inline _LIBCPP_INLINE_VISIBILITY
392 constexpr span(element_type (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}
394 template <size_t _Sz>
395 inline _LIBCPP_INLINE_VISIBILITY
396 constexpr span(array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
398 template <size_t _Sz>
399 inline _LIBCPP_INLINE_VISIBILITY
400 constexpr span(const array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
402 template <class _Container>
403 inline _LIBCPP_INLINE_VISIBILITY
404 constexpr span( _Container& __c,
405 enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
406 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}
408 template <class _Container>
409 inline _LIBCPP_INLINE_VISIBILITY
410 constexpr span(const _Container& __c,
411 enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
412 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}
415 template <class _OtherElementType, ptrdiff_t _OtherExtent>
416 inline _LIBCPP_INLINE_VISIBILITY
417 constexpr span(const span<_OtherElementType, _OtherExtent>& __other,
419 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
420 nullptr_t> = nullptr) noexcept
421 : __data{__other.data()}, __size{__other.size()} {}
423 // ~span() noexcept = default;
425 template <ptrdiff_t _Count>
426 inline _LIBCPP_INLINE_VISIBILITY
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()");
431 return {data(), _Count};
434 template <ptrdiff_t _Count>
435 inline _LIBCPP_INLINE_VISIBILITY
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()");
440 return {data() + size() - _Count, _Count};
443 _LIBCPP_INLINE_VISIBILITY
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)");
447 return {data(), __count};
450 _LIBCPP_INLINE_VISIBILITY
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)");
454 return {data() + size() - __count, __count};
457 template <ptrdiff_t _Offset, ptrdiff_t _Count = dynamic_extent>
458 inline _LIBCPP_INLINE_VISIBILITY
459 constexpr span<_Tp, dynamic_extent> subspan() const noexcept
461 _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");
462 _LIBCPP_ASSERT(_Count == dynamic_extent || _Offset + _Count <= size(), "Count out of range in span::subspan()");
463 return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
466 constexpr span<element_type, dynamic_extent>
467 inline _LIBCPP_INLINE_VISIBILITY
468 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
470 _LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset, count)");
471 _LIBCPP_ASSERT((__count >= 0 && __count <= size()) || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");
472 if (__count == dynamic_extent)
473 return {data() + __offset, size() - __offset};
474 _LIBCPP_ASSERT(__offset + __count <= size(), "Offset + count out of range in span::subspan(offset, count)");
475 return {data() + __offset, __count};
478 _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return __size; }
479 _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return __size * sizeof(element_type); }
480 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; }
482 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept
484 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>[] index out of bounds");
485 return __data[__idx];
488 _LIBCPP_INLINE_VISIBILITY constexpr reference operator()(index_type __idx) const noexcept
490 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>() index out of bounds");
491 return __data[__idx];
494 _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }
496 // [span.iter], span iterator support
497 _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); }
498 _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); }
499 _LIBCPP_INLINE_VISIBILITY constexpr const_iterator cbegin() const noexcept { return const_iterator(data()); }
500 _LIBCPP_INLINE_VISIBILITY constexpr const_iterator cend() const noexcept { return const_iterator(data() + size()); }
501 _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
502 _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
503 _LIBCPP_INLINE_VISIBILITY constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); }
504 _LIBCPP_INLINE_VISIBILITY constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
506 _LIBCPP_INLINE_VISIBILITY constexpr void swap(span &__other) noexcept
508 pointer __p = __data;
509 __data = __other.__data;
510 __other.__data = __p;
512 index_type __sz = __size;
513 __size = __other.__size;
514 __other.__size = __sz;
517 _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept
518 { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
520 _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writeable_bytes() const noexcept
521 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
528 // as_bytes & as_writeable_bytes
529 template <class _Tp, ptrdiff_t _Extent>
530 auto as_bytes(span<_Tp, _Extent> __s) noexcept
531 -> decltype(__s.__as_bytes())
532 { return __s.__as_bytes(); }
534 template <class _Tp, ptrdiff_t _Extent>
535 auto as_writeable_bytes(span<_Tp, _Extent> __s) noexcept
536 -> typename enable_if<!is_const_v<_Tp>, decltype(__s.__as_writeable_bytes())>::type
537 { return __s.__as_writeable_bytes(); }
539 template <class _Tp, ptrdiff_t _Extent>
540 constexpr void swap(span<_Tp, _Extent> &__lhs, span<_Tp, _Extent> &__rhs) noexcept
541 { __lhs.swap(__rhs); }
545 template<class _Tp, size_t _Sz>
546 span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
548 template<class _Tp, size_t _Sz>
549 span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
551 template<class _Tp, size_t _Sz>
552 span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
554 template<class _Container>
555 span(_Container&) -> span<typename _Container::value_type>;
557 template<class _Container>
558 span(const _Container&) -> span<const typename _Container::value_type>;
560 #endif // _LIBCPP_STD_VER > 17
562 _LIBCPP_END_NAMESPACE_STD
564 #endif // _LIBCPP_SPAN