diff --git a/libcxx/include/span b/libcxx/include/span --- a/libcxx/include/span +++ b/libcxx/include/span @@ -39,7 +39,7 @@ // constants and types using element_type = ElementType; using value_type = remove_cv_t; - using index_type = size_t; + using size_type = size_t; using difference_type = ptrdiff_t; using pointer = element_type*; using const_pointer = const element_type*; @@ -49,11 +49,11 @@ using const_iterator = implementation-defined; using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; - static constexpr index_type extent = Extent; + static constexpr size_type extent = Extent; // [span.cons], span constructors, copy, assignment, and destructor constexpr span() noexcept; - constexpr span(pointer ptr, index_type count); + constexpr span(pointer ptr, size_type count); constexpr span(pointer firstElem, pointer lastElem); template constexpr span(element_type (&arr)[N]) noexcept; @@ -79,17 +79,17 @@ template constexpr span subspan() const; - constexpr span first(index_type count) const; - constexpr span last(index_type count) const; - constexpr span subspan(index_type offset, index_type count = dynamic_extent) const; + constexpr span first(size_type count) const; + constexpr span last(size_type count) const; + constexpr span subspan(size_type offset, size_type count = dynamic_extent) const; // [span.obs], span observers - constexpr index_type size() const noexcept; - constexpr index_type size_bytes() const noexcept; + constexpr size_type size() const noexcept; + constexpr size_type size_bytes() const noexcept; constexpr bool empty() const noexcept; // [span.elem], span element access - constexpr reference operator[](index_type idx) const; + constexpr reference operator[](size_type idx) const; constexpr reference front() const; constexpr reference back() const; constexpr pointer data() const noexcept; @@ -105,8 +105,8 @@ constexpr const_reverse_iterator crend() const noexcept; private: - pointer data_; // exposition only - index_type size_; // exposition only + pointer data_; // exposition only + size_type size_; // exposition only }; template @@ -195,7 +195,7 @@ // constants and types using element_type = _Tp; using value_type = remove_cv_t<_Tp>; - using index_type = size_t; + using size_type = size_t; using difference_type = ptrdiff_t; using pointer = _Tp *; using const_pointer = const _Tp *; @@ -206,7 +206,7 @@ using reverse_iterator = _VSTD::reverse_iterator; using const_reverse_iterator = _VSTD::reverse_iterator; - static constexpr index_type extent = _Extent; + static constexpr size_type extent = _Extent; // [span.cons], span constructors, copy, assignment, and destructor _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} @@ -215,7 +215,7 @@ constexpr span (const span&) noexcept = default; constexpr span& operator=(const span&) noexcept = default; - _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr} + _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr} { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); } _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f} { (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); } @@ -260,14 +260,14 @@ } _LIBCPP_INLINE_VISIBILITY - constexpr span first(index_type __count) const noexcept + constexpr span first(size_type __count) const noexcept { _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)"); return {data(), __count}; } _LIBCPP_INLINE_VISIBILITY - constexpr span last(index_type __count) const noexcept + constexpr span last(size_type __count) const noexcept { _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)"); return {data() + size() - __count, __count}; @@ -285,7 +285,7 @@ _LIBCPP_INLINE_VISIBILITY constexpr span - subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept + subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept { _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)"); _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)"); @@ -295,11 +295,11 @@ return {data() + __offset, __count}; } - _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return _Extent; } - _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return _Extent * sizeof(element_type); } - _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; } + _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return _Extent; } + _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); } + _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; } - _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept + _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept { _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span[] index out of bounds"); return __data[__idx]; @@ -356,7 +356,7 @@ // constants and types using element_type = _Tp; using value_type = remove_cv_t<_Tp>; - using index_type = size_t; + using size_type = size_t; using difference_type = ptrdiff_t; using pointer = _Tp *; using const_pointer = const _Tp *; @@ -367,7 +367,7 @@ using reverse_iterator = _VSTD::reverse_iterator; using const_reverse_iterator = _VSTD::reverse_iterator; - static constexpr index_type extent = dynamic_extent; + static constexpr size_type extent = dynamic_extent; // [span.cons], span constructors, copy, assignment, and destructor _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {} @@ -375,7 +375,7 @@ constexpr span (const span&) noexcept = default; constexpr span& operator=(const span&) noexcept = default; - _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}, __size{__count} {} + _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}, __size{__count} {} _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast(distance(__f, __l))} {} template @@ -394,13 +394,13 @@ _LIBCPP_INLINE_VISIBILITY constexpr span( _Container& __c, enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr) - : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {} + : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} template _LIBCPP_INLINE_VISIBILITY constexpr span(const _Container& __c, enable_if_t<__is_span_compatible_container::value, nullptr_t> = nullptr) - : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {} + : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} template @@ -430,14 +430,14 @@ } _LIBCPP_INLINE_VISIBILITY - constexpr span first(index_type __count) const noexcept + constexpr span first(size_type __count) const noexcept { _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)"); return {data(), __count}; } _LIBCPP_INLINE_VISIBILITY - constexpr span last (index_type __count) const noexcept + constexpr span last (size_type __count) const noexcept { _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)"); return {data() + size() - __count, __count}; @@ -454,7 +454,7 @@ constexpr span _LIBCPP_INLINE_VISIBILITY - subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept + subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept { _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)"); _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)"); @@ -464,11 +464,11 @@ return {data() + __offset, __count}; } - _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return __size; } - _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return __size * sizeof(element_type); } - _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; } + _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return __size; } + _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return __size * sizeof(element_type); } + _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; } - _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept + _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept { _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span[] index out of bounds"); return __data[__idx]; @@ -505,7 +505,7 @@ __data = __other.__data; __other.__data = __p; - index_type __sz = __size; + size_type __sz = __size; __size = __other.__size; __other.__size = __sz; } @@ -517,8 +517,8 @@ { return {reinterpret_cast(data()), size_bytes()}; } private: - pointer __data; - index_type __size; + pointer __data; + size_type __size; }; // tuple interface diff --git a/libcxx/test/std/containers/views/span.cons/assign.pass.cpp b/libcxx/test/std/containers/views/span.cons/assign.pass.cpp --- a/libcxx/test/std/containers/views/span.cons/assign.pass.cpp +++ b/libcxx/test/std/containers/views/span.cons/assign.pass.cpp @@ -43,11 +43,11 @@ // constexpr dynamically sized assignment { // On systems where 'ptrdiff_t' is a synonym for 'int', -// the call span(ptr, 0) selects the (pointer, index_type) constructor. +// the call span(ptr, 0) selects the (pointer, size_type) constructor. // On systems where 'ptrdiff_t' is NOT a synonym for 'int', // it is ambiguous, because of 0 also being convertible to a null pointer // and so the compiler can't choose between: -// span(pointer, index_type) +// span(pointer, size_type) // and span(pointer, pointer) // We cast zero to std::ptrdiff_t to remove that ambiguity. // Example: diff --git a/libcxx/test/std/containers/views/span.cons/ptr_len.fail.cpp b/libcxx/test/std/containers/views/span.cons/ptr_len.fail.cpp --- a/libcxx/test/std/containers/views/span.cons/ptr_len.fail.cpp +++ b/libcxx/test/std/containers/views/span.cons/ptr_len.fail.cpp @@ -10,7 +10,7 @@ // -// constexpr span(pointer ptr, index_type count); +// constexpr span(pointer ptr, size_type count); // Requires: [ptr, ptr + count) shall be a valid range. // If extent is not equal to dynamic_extent, then count shall be equal to extent. // diff --git a/libcxx/test/std/containers/views/span.cons/ptr_len.pass.cpp b/libcxx/test/std/containers/views/span.cons/ptr_len.pass.cpp --- a/libcxx/test/std/containers/views/span.cons/ptr_len.pass.cpp +++ b/libcxx/test/std/containers/views/span.cons/ptr_len.pass.cpp @@ -10,7 +10,7 @@ // -// constexpr span(pointer ptr, index_type count); +// constexpr span(pointer ptr, size_type count); // Requires: [ptr, ptr + count) shall be a valid range. // If extent is not equal to dynamic_extent, then count shall be equal to extent. // diff --git a/libcxx/test/std/containers/views/span.elem/op_idx.pass.cpp b/libcxx/test/std/containers/views/span.elem/op_idx.pass.cpp --- a/libcxx/test/std/containers/views/span.elem/op_idx.pass.cpp +++ b/libcxx/test/std/containers/views/span.elem/op_idx.pass.cpp @@ -10,8 +10,8 @@ // -// constexpr reference operator[](index_type idx) const; -// constexpr reference operator()(index_type idx) const; +// constexpr reference operator[](size_type idx) const; +// constexpr reference operator()(size_type idx) const; // diff --git a/libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp b/libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp --- a/libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp +++ b/libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp @@ -31,7 +31,7 @@ } else { - const typename Span::index_type last = s.size() - 1; + const typename Span::size_type last = s.size() - 1; ret = ret && ( *b == s[last]); ret = ret && ( &*b == &s[last]); ret = ret && ( *cb == s[last]); @@ -54,7 +54,7 @@ } else { - const typename Span::index_type last = s.size() - 1; + const typename Span::size_type last = s.size() - 1; assert( *b == s[last]); assert( &*b == &s[last]); assert( *cb == s[last]); diff --git a/libcxx/test/std/containers/views/span.obs/size.pass.cpp b/libcxx/test/std/containers/views/span.obs/size.pass.cpp --- a/libcxx/test/std/containers/views/span.obs/size.pass.cpp +++ b/libcxx/test/std/containers/views/span.obs/size.pass.cpp @@ -10,7 +10,7 @@ // -// constexpr index_type size() const noexcept; +// constexpr size_type size() const noexcept; // diff --git a/libcxx/test/std/containers/views/span.obs/size_bytes.pass.cpp b/libcxx/test/std/containers/views/span.obs/size_bytes.pass.cpp --- a/libcxx/test/std/containers/views/span.obs/size_bytes.pass.cpp +++ b/libcxx/test/std/containers/views/span.obs/size_bytes.pass.cpp @@ -10,7 +10,7 @@ // -// constexpr index_type size_bytes() const noexcept; +// constexpr size_type size_bytes() const noexcept; // // Effects: Equivalent to: return size() * sizeof(element_type); diff --git a/libcxx/test/std/containers/views/span.sub/first.pass.cpp b/libcxx/test/std/containers/views/span.sub/first.pass.cpp --- a/libcxx/test/std/containers/views/span.sub/first.pass.cpp +++ b/libcxx/test/std/containers/views/span.sub/first.pass.cpp @@ -13,7 +13,7 @@ // template // constexpr span first() const; // -// constexpr span first(index_type count) const; +// constexpr span first(size_type count) const; // // Requires: 0 <= Count && Count <= size(). diff --git a/libcxx/test/std/containers/views/span.sub/last.pass.cpp b/libcxx/test/std/containers/views/span.sub/last.pass.cpp --- a/libcxx/test/std/containers/views/span.sub/last.pass.cpp +++ b/libcxx/test/std/containers/views/span.sub/last.pass.cpp @@ -13,7 +13,7 @@ // template // constexpr span last() const; // -// constexpr span last(index_type count) const; +// constexpr span last(size_type count) const; // // Requires: 0 <= Count && Count <= size(). diff --git a/libcxx/test/std/containers/views/span.sub/subspan.pass.cpp b/libcxx/test/std/containers/views/span.sub/subspan.pass.cpp --- a/libcxx/test/std/containers/views/span.sub/subspan.pass.cpp +++ b/libcxx/test/std/containers/views/span.sub/subspan.pass.cpp @@ -14,7 +14,7 @@ // constexpr span subspan() const; // // constexpr span subspan( -// index_type offset, index_type count = dynamic_extent) const; +// size_type offset, size_type count = dynamic_extent) const; // // Requires: (0 <= Offset && Offset <= size()) // && (Count == dynamic_extent || Count >= 0 && Offset + Count <= size()) diff --git a/libcxx/test/std/containers/views/types.pass.cpp b/libcxx/test/std/containers/views/types.pass.cpp --- a/libcxx/test/std/containers/views/types.pass.cpp +++ b/libcxx/test/std/containers/views/types.pass.cpp @@ -16,7 +16,7 @@ // // constants and types // using element_type = ElementType; // using value_type = remove_cv_t; -// using index_type = size_t; +// using size_type = size_t; // using difference_type = ptrdiff_t; // using pointer = element_type *; // using reference = element_type &; @@ -27,7 +27,7 @@ // using reverse_iterator = std::reverse_iterator; // using const_reverse_iterator = std::reverse_iterator; // -// static constexpr index_type extent = Extent; +// static constexpr size_type extent = Extent; // #include @@ -68,7 +68,7 @@ { ASSERT_SAME_TYPE(typename S::element_type, ElementType); ASSERT_SAME_TYPE(typename S::value_type, std::remove_cv_t); - ASSERT_SAME_TYPE(typename S::index_type, std::size_t); + ASSERT_SAME_TYPE(typename S::size_type, std::size_t); ASSERT_SAME_TYPE(typename S::difference_type, std::ptrdiff_t); ASSERT_SAME_TYPE(typename S::pointer, ElementType *); ASSERT_SAME_TYPE(typename S::const_pointer, const ElementType *); diff --git a/libcxx/www/cxx2a_status.html b/libcxx/www/cxx2a_status.html --- a/libcxx/www/cxx2a_status.html +++ b/libcxx/www/cxx2a_status.html @@ -209,13 +209,13 @@ P1721LWGMandating the Standard Library: Clause 29 - Input/Output library Belfast P1722LWGMandating the Standard Library: Clause 30 - Regular Expression library Belfast P1723LWGMandating the Standard Library: Clause 31 - Atomics library Belfast - P1855LWGMake freestanding Belfast + P1855LWGMake <compare> freestanding Belfast P1862LWGRanges adaptors for non-copyable iterators Belfast P1865LWGAdd max() to latch and barrier Belfast P1869LWGRename 'condition_variable_any' interruptible wait methods Belfast P1870LWGforwarding-range is too subtle Belfast P1871LWGShould concepts be enabled or disabled? Belfast - P1872LWGspan should have size_type, not index_type Belfast + P1872LWGspan should have size_type, not index_type BelfastComplete10.0 P1878LWGConstraining Readable Types Belfast P1892LWGExtended locale-specific presentation specifiers for std::format Belfast P1902LWGMissing feature-test macros 2018-2019 Belfast