[libcxx-commits] [PATCH] D108855: [libcxx] contiguous iterator concept: don't require pointer or complete element types

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 27 21:40:51 PDT 2021


jloser updated this revision to Diff 369234.
jloser edited the summary of this revision.
jloser added a comment.

[NFC] Fix formatting of `element_type` type alias.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108855/new/

https://reviews.llvm.org/D108855

Files:
  libcxx/include/__iterator/concepts.h
  libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp


Index: libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp
===================================================================
--- libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp
+++ libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp
@@ -101,6 +101,7 @@
 struct wrong_iter_reference_t {
     typedef std::contiguous_iterator_tag    iterator_category;
     typedef short                           value_type;
+    typedef short element_type;
     typedef std::ptrdiff_t                  difference_type;
     typedef int*                            pointer;
     typedef short&                          reference;
@@ -164,7 +165,6 @@
 };
 
 static_assert(std::random_access_iterator<no_element_type>);
-static_assert(!std::contiguous_iterator<no_element_type>);
 
 struct to_address_wrong_return_type {
     typedef std::contiguous_iterator_tag    iterator_category;
Index: libcxx/include/__iterator/concepts.h
===================================================================
--- libcxx/include/__iterator/concepts.h
+++ libcxx/include/__iterator/concepts.h
@@ -171,7 +171,6 @@
   derived_from<_ITER_CONCEPT<_Ip>, contiguous_iterator_tag> &&
   is_lvalue_reference_v<iter_reference_t<_Ip>> &&
   same_as<iter_value_t<_Ip>, remove_cvref_t<iter_reference_t<_Ip>>> &&
-  (is_pointer_v<_Ip> || requires { sizeof(__pointer_traits_element_type<_Ip>); }) &&
   requires(const _Ip& __i) {
     { _VSTD::to_address(__i) } -> same_as<add_pointer_t<iter_reference_t<_Ip>>>;
   };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108855.369234.patch
Type: text/x-patch
Size: 1722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210828/dcd824b3/attachment-0001.bin>


More information about the libcxx-commits mailing list