[libcxx-commits] [libcxx] [libcxx][test] Do not assume array::iterator is a pointer (PR #100603)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 27 09:42:40 PDT 2024


================
@@ -339,59 +339,91 @@ cpp20_random_access_iterator(It) -> cpp20_random_access_iterator<It>;
 
 static_assert(std::random_access_iterator<cpp20_random_access_iterator<int*>>);
 
-template <class It>
-class contiguous_iterator
-{
-    static_assert(std::is_pointer_v<It>, "Things probably break in this case");
+template <std::contiguous_iterator It>
+class contiguous_iterator {
+  It it_;
 
-    It it_;
+  template <std::contiguous_iterator U>
+  friend class contiguous_iterator;
 
-    template <class U> friend class contiguous_iterator;
 public:
     typedef          std::contiguous_iterator_tag              iterator_category;
     typedef typename std::iterator_traits<It>::value_type      value_type;
     typedef typename std::iterator_traits<It>::difference_type difference_type;
     typedef It                                                 pointer;
     typedef typename std::iterator_traits<It>::reference       reference;
-    typedef typename std::remove_pointer<It>::type             element_type;
+    typedef value_type element_type;
----------------
mordante wrote:

please fix the alignment with the lines above.

https://github.com/llvm/llvm-project/pull/100603


More information about the libcxx-commits mailing list