[libcxx-commits] [libcxx] 298331f - [libc++][ranges][NFC] Test new requirements for `basic_string_view` and `span` iterators.
Konstantin Varlamov via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 2 12:54:59 PST 2022
Author: Konstantin Varlamov
Date: 2022-02-02T12:54:39-08:00
New Revision: 298331f14d0275d17a01fda220ea64a9a1b70bb9
URL: https://github.com/llvm/llvm-project/commit/298331f14d0275d17a01fda220ea64a9a1b70bb9
DIFF: https://github.com/llvm/llvm-project/commit/298331f14d0275d17a01fda220ea64a9a1b70bb9.diff
LOG: [libc++][ranges][NFC] Test new requirements for `basic_string_view` and `span` iterators.
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).
Reviewed By: #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D118687
Added:
Modified:
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
Removed:
################################################################################
diff --git a/libcxx/docs/Status/RangesPaper.csv b/libcxx/docs/Status/RangesPaper.csv
index 3a263f22f934f..4b521ac135ea7 100644
--- a/libcxx/docs/Status/RangesPaper.csv
+++ b/libcxx/docs/Status/RangesPaper.csv
@@ -32,8 +32,8 @@ Section,Description,Dependencies,Assignee,Complete
| `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/D118687>`_,[iterator.concepts],Konstantin Varlamov,✅
+`[views.span] <https://wg21.link/views.span>`_,`Same as [strings] <https://llvm.org/D118687>`_,[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>`_
diff --git a/libcxx/test/std/containers/views/span.iterators/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/views/span.iterators/iterator_concept_conformance.compile.pass.cpp
index c9ae472bc494e..d994d3f411c75 100644
--- a/libcxx/test/std/containers/views/span.iterators/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/views/span.iterators/iterator_concept_conformance.compile.pass.cpp
@@ -14,12 +14,14 @@
#include <span>
#include <iterator>
+#include "test_macros.h"
using iterator = std::span<int>::iterator;
using reverse_iterator = std::span<int>::reverse_iterator;
using value_type = int;
static_assert(std::contiguous_iterator<iterator>);
+LIBCPP_STATIC_ASSERT(std::__is_cpp17_random_access_iterator<iterator>::value);
static_assert(std::indirectly_writable<iterator, value_type>);
static_assert(std::sentinel_for<iterator, iterator>);
static_assert(!std::sentinel_for<iterator, reverse_iterator>);
diff --git a/libcxx/test/std/strings/string.view/string.view.iterators/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/strings/string.view/string.view.iterators/iterator_concept_conformance.compile.pass.cpp
index 7e998efb0685c..711bfd6fa6485 100644
--- a/libcxx/test/std/strings/string.view/string.view.iterators/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.iterators/iterator_concept_conformance.compile.pass.cpp
@@ -15,12 +15,15 @@
#include <iterator>
+#include "test_macros.h"
+
using iterator = std::string_view::iterator;
using const_iterator = std::string_view::const_iterator;
using reverse_iterator = std::string_view::reverse_iterator;
using const_reverse_iterator = std::string_view::const_reverse_iterator;
static_assert(std::contiguous_iterator<iterator>);
+LIBCPP_STATIC_ASSERT(std::__is_cpp17_random_access_iterator<iterator>::value);
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,7 @@ static_assert(std::indirectly_movable_storable<iterator, char*>);
static_assert(!std::indirectly_swappable<iterator, iterator>);
static_assert(std::contiguous_iterator<const_iterator>);
+LIBCPP_STATIC_ASSERT(std::__is_cpp17_random_access_iterator<const_iterator>::value);
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>);
More information about the libcxx-commits
mailing list