[libcxx-commits] [PATCH] D118687: [libc++][ranges][NFC] Test new requirements for `basic_string_view` and `span` iterators.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 1 02:34:33 PST 2022


var-const created this revision.
var-const requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Note that most changes to `strings` and `views.span` from the One Ranges
Proposal are no longer applicable:

- free `begin` and `end` functions taking `basic_string_view` and `span` were removed by P1870 <http://wg21.link/p1870>;
- `span::const_iterator` was removed by LWG3320 <https://cplusplus.github.io/LWG/lwg-defects.html#3320>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118687

Files:
  libcxx/docs/Status/RangesPaper.csv
  libcxx/test/std/containers/views/span.iterators/iterator_concept_conformance.compile.pass.cpp
  libcxx/test/std/strings/string.view/string.view.iterators/iterator_concept_conformance.compile.pass.cpp


Index: libcxx/test/std/strings/string.view/string.view.iterators/iterator_concept_conformance.compile.pass.cpp
===================================================================
--- libcxx/test/std/strings/string.view/string.view.iterators/iterator_concept_conformance.compile.pass.cpp
+++ libcxx/test/std/strings/string.view/string.view.iterators/iterator_concept_conformance.compile.pass.cpp
@@ -21,6 +21,9 @@
 using const_reverse_iterator = std::string_view::const_reverse_iterator;
 
 static_assert(std::contiguous_iterator<iterator>);
+#ifdef _LIBCPP_VERSION
+static_assert(std::__is_cpp17_random_access_iterator<iterator>::value);
+#endif
 static_assert(!std::indirectly_writable<iterator, char>);
 static_assert(std::sentinel_for<iterator, iterator>);
 static_assert(std::sentinel_for<iterator, const_iterator>);
@@ -35,6 +38,9 @@
 static_assert(!std::indirectly_swappable<iterator, iterator>);
 
 static_assert(std::contiguous_iterator<const_iterator>);
+#ifdef _LIBCPP_VERSION
+static_assert(std::__is_cpp17_random_access_iterator<const_iterator>::value);
+#endif
 static_assert(!std::indirectly_writable<const_iterator, char>);
 static_assert(std::sentinel_for<const_iterator, iterator>);
 static_assert(std::sentinel_for<const_iterator, const_iterator>);
Index: libcxx/test/std/containers/views/span.iterators/iterator_concept_conformance.compile.pass.cpp
===================================================================
--- libcxx/test/std/containers/views/span.iterators/iterator_concept_conformance.compile.pass.cpp
+++ libcxx/test/std/containers/views/span.iterators/iterator_concept_conformance.compile.pass.cpp
@@ -20,6 +20,9 @@
 using value_type = int;
 
 static_assert(std::contiguous_iterator<iterator>);
+#ifdef _LIBCPP_VERSION
+static_assert(std::__is_cpp17_random_access_iterator<iterator>::value);
+#endif
 static_assert(std::indirectly_writable<iterator, value_type>);
 static_assert(std::sentinel_for<iterator, iterator>);
 static_assert(!std::sentinel_for<iterator, reverse_iterator>);
Index: libcxx/docs/Status/RangesPaper.csv
===================================================================
--- libcxx/docs/Status/RangesPaper.csv
+++ libcxx/docs/Status/RangesPaper.csv
@@ -32,8 +32,8 @@
 | `ranges::destroy <https://llvm.org/D116078>`_
 | `ranges::destroy_at <https://llvm.org/D116078>`_
 | `ranges::destroy_n <https://llvm.org/D116078>`_",[special.mem.concepts],Konstantin Varlamov,✅
-`[strings] <https://wg21.link/strings>`_,Adds begin/end and updates const_iterator.,[iterator.concepts],Unassigned,Not started
-`[views.span] <https://wg21.link/views.span>`_,Same as [strings],[iterator.concepts],Unassigned,Not started
+`[strings] <https://wg21.link/strings>`_,`Adds begin/end and updates const_iterator. <https://llvm.org/TODO>`_,[iterator.concepts],Konstantin Varlamov,✅
+`[views.span] <https://wg21.link/views.span>`_,`Same as [strings] <https://llvm.org/TODO>`_,[iterator.concepts],Konstantin Varlamov,✅
 `[iterator.cust.move] <https://wg21.link/iterator.cust.move>`_,`ranges::iter_move <https://llvm.org/D99873>`_,,Zoe Carver,✅
 `[iterator.cust.swap] <https://wg21.link/iterator.cust.swap>`_,`ranges::iter_swap <https://llvm.org/D102809>`_,iter_value_t,Zoe Carver,✅
 `[iterator.concepts] <https://wg21.link/iterator.concepts>`_,"| `indirectly_readable <https://llvm.org/D100073>`_


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118687.404858.patch
Type: text/x-patch
Size: 3335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220201/26d392ba/attachment-0001.bin>


More information about the libcxx-commits mailing list