Lines Matching +full:data +full:- +full:size

1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===---------------------------------------------------------------------===//
22 concept integral-constant-like = // exposition only, since C++26
31 constexpr size_t maybe-static-ext = dynamic_extent; // exposition only, since C++26
32 template<integral-constant-like T>
33 constexpr size_t maybe-static-ext<T> = {T::value};
67 using iterator = implementation-defined;
104 constexpr size_type size() const noexcept;
113 constexpr pointer data() const noexcept;
127 …span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>; …
129 …span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>, maybe-static-ext<EndOrSize>>…
132 span(T (&)[N]) -> span<T, N>;
135 span(array<T, N>&) -> span<T, N>;
138 span(const array<T, N>&) -> span<const T, N>;
141 span(R&&) -> span<remove_reference_t<ranges::range_reference_t<R>>>;
160 #include <__ranges/data.h>
163 #include <__ranges/size.h>
181 // standard-mandated includes
185 #include <__iterator/data.h>
188 #include <__iterator/size.h>
258 _Extent == __il.size(), "Size mismatch in span's constructor _Extent != __il.size().");
268 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __count, "size mismatch in span's constructor (iter…
274 // Throws: When and what last - first throws.
275 [[maybe_unused]] auto __dist = __last - __first;
278 …__dist == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != exte…
284 …OM_ABI constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
289 : __data_{__arr.data()} {}
292 _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} {
293 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(ranges::size(__r) == _Extent, "size mismatch in span's constru…
298 : __data_{__other.data()} {}
302 : __data_{__other.data()} {
303 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __other.size(), "size mismatch in span's constructo…
309 return span<element_type, _Count>{data(), _Count};
315 return span<element_type, _Count>{data() + size() - _Count, _Count};
319 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::first(count): count out of ran…
320 return {data(), __count};
324 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::last(count): count out of rang…
325 return {data() + size() - __count, __count};
330 …subspan() const noexcept -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offs…
332 static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
335 using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
336 return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
341 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T, N>::subspan(offset, count): offse…
343 return {data() + __offset, size() - __offset};
345 … __count <= size() - __offset, "span<T, N>::subspan(offset, count): offset + count out of range");
346 return {data() + __offset, __count};
349 _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return _Extent; }
354 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T, N>::operator[](index): index out of r…
360 if (__index >= size())
373 return __data_[size() - 1];
376 _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
381 return std::__make_bounded_iter(data(), data(), data() + size());
383 return iterator(data());
388 return std::__make_bounded_iter(data() + size(), data(), data() + size());
390 return iterator(data() + size());
397 …return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte*>(data()), siz…
401 … return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte*>(data()), size_bytes()};
435 : __data_{__il.begin()}, __size_{__il.size()} {}
447 : __data_(std::to_address(__first)), __size_(__last - __first) {
448 …_LIBCPP_ASSERT_VALID_INPUT_RANGE(__last - __first >= 0, "invalid range in span's constructor (iter…
457 : __data_{__arr.data()}, __size_{_Sz} {}
462 : __data_{__arr.data()}, __size_{_Sz} {}
465 …IDE_FROM_ABI constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::size(__r)}…
469 : __data_{__other.data()}, __size_{__other.size()} {}
473 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::first<Count>(): Count out of range…
474 return span<element_type, _Count>{data(), _Count};
479 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::last<Count>(): Count out of range"…
480 return span<element_type, _Count>{data() + size() - _Count, _Count};
484 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::first(count): count out of range"…
485 return {data(), __count};
489 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::last(count): count out of range");
490 return {data() + size() - __count, __count};
495 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset …
496 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count == dynamic_extent || _Count <= size() - _Offset,
498 …return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : …
503 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T>::subspan(offset, count): offset o…
505 return {data() + __offset, size() - __offset};
507 … __count <= size() - __offset, "span<T>::subspan(offset, count): offset + count out of range");
508 return {data() + __offset, __count};
511 _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return __size_; }
516 …_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T>::operator[](index): index out of rang…
522 if (__index >= size())
535 return __data_[size() - 1];
538 _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
543 return std::__make_bounded_iter(data(), data(), data() + size());
545 return iterator(data());
550 return std::__make_bounded_iter(data() + size(), data(), data() + size());
552 return iterator(data() + size());
559 return {reinterpret_cast<const byte*>(data()), size_bytes()};
563 return {reinterpret_cast<byte*>(data()), size_bytes()};
604 span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>, __maybe_static_ext<_EndOrS…
607 span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
611 span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
614 span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
617 span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
620 span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;