[libcxx-commits] [PATCH] D100730: [libc++] Simplify debug iterators, and fix a couple of non-explicit constructors.
    Arthur O'Dwyer via Phabricator via libcxx-commits 
    libcxx-commits at lists.llvm.org
       
    Sun Apr 18 12:22:00 PDT 2021
    
    
  
Quuxplusone added a subscriber: mclow.lists.
Quuxplusone added inline comments.
================
Comment at: libcxx/include/span:346-350
 // [span.iter], span iterator support
-    _LIBCPP_INLINE_VISIBILITY constexpr iterator                 begin() const noexcept { return iterator(data()); }
-    _LIBCPP_INLINE_VISIBILITY constexpr iterator                   end() const noexcept { return iterator(data() + size()); }
+    _LIBCPP_INLINE_VISIBILITY constexpr iterator                 begin() const noexcept { return iterator(data(), this); }
+    _LIBCPP_INLINE_VISIBILITY constexpr iterator                   end() const noexcept { return iterator(data() + size(), this); }
     _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator        rbegin() const noexcept { return reverse_iterator(end()); }
     _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator          rend() const noexcept { return reverse_iterator(begin()); }
----------------
@mclow.lists added the debug iterators for `span`. Personally I'm not convinced that `span` really ought to count as a "container" in the debug-iterator sense, and maybe it ought to just use plain old raw pointers as its iterators; but for the purposes of this patch, I left it as-is.
I was too lazy to add a test (especially given the previous paragraph), but this PR //does// incidentally fix `span` in debug mode. Example of current brokenness: https://godbolt.org/z/hP6sa68sM
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100730/new/
https://reviews.llvm.org/D100730
    
    
More information about the libcxx-commits
mailing list