[libcxx-commits] [PATCH] D101003: [libc++] <span>, like <string_view>, has no use for debug iterators.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 21 15:43:49 PDT 2021
Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, mclow.lists, zoecarver, curdeius, Mordante.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
A span has no idea what container (if any) "owns" its iterators, nor
under what circumstances they might become invalidated.
This fixes the following libcxx tests under `-D_LIBCPP_DEBUG=1`:
- libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
- libcxx/test/std/containers/views/span.iterators/begin.pass.cpp
- libcxx/test/std/containers/views/span.iterators/end.pass.cpp
- libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp
- libcxx/test/std/containers/views/span.iterators/rend.pass.cpp
- libcxx/test/std/containers/views/span.sub/first.pass.cpp
- libcxx/test/std/containers/views/span.sub/last.pass.cpp
- libcxx/test/std/containers/views/span.sub/subspan.pass.cpp
It does occur to me that we could probably come up with a strategy for `string_view` and `span` to do debug iterators, where you could form an association of a `string_view` object with a `C` object, and the `string_view`'s iterators would be sort of "transitively" associated with that `C`; and this association would be formed whenever you (1) converted a `string` directly to a `string_view` or (2) constructed a `string_view` from a pair of `C::iterator` (for `C`=`string` or `vector`). //However//, this idea is clearly beyond the scope of this PR, and I'm not aware that anyone is asking for it to exist, either.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101003
Files:
libcxx/include/span
Index: libcxx/include/span
===================================================================
--- libcxx/include/span
+++ libcxx/include/span
@@ -200,7 +200,7 @@
using const_pointer = const _Tp *;
using reference = _Tp &;
using const_reference = const _Tp &;
- using iterator = __wrap_iter<pointer>;
+ using iterator = pointer;
using reverse_iterator = _VSTD::reverse_iterator<iterator>;
static constexpr size_type extent = _Extent;
@@ -375,7 +375,7 @@
using const_pointer = const _Tp *;
using reference = _Tp &;
using const_reference = const _Tp &;
- using iterator = __wrap_iter<pointer>;
+ using iterator = pointer;
using reverse_iterator = _VSTD::reverse_iterator<iterator>;
static constexpr size_type extent = dynamic_extent;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101003.339413.patch
Type: text/x-patch
Size: 926 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210421/1663d9e6/attachment-0001.bin>
More information about the libcxx-commits
mailing list