[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
Thu Apr 29 15:03:52 PDT 2021
Quuxplusone updated this revision to Diff 341669.
Quuxplusone added a comment.
Added under `_LIBCPP_ABI_SPAN_POINTER_ITERATORS`.
(We're still doing pointers unconditionally when `_LIBCPP_DEBUG==2`, because otherwise things don't compile; and we always want things to be able to compile in debug mode. Right?)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101003/new/
https://reviews.llvm.org/D101003
Files:
libcxx/include/__config
libcxx/include/span
Index: libcxx/include/span
===================================================================
--- libcxx/include/span
+++ libcxx/include/span
@@ -200,7 +200,11 @@
using const_pointer = const _Tp *;
using reference = _Tp &;
using const_reference = const _Tp &;
- using iterator = __wrap_iter<pointer>;
+#if (_LIBCPP_DEBUG == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
+ using iterator = pointer;
+#else
+ using iterator = __wrap_iter<pointer>; // to maintain our ABI
+#endif
using reverse_iterator = _VSTD::reverse_iterator<iterator>;
static constexpr size_type extent = _Extent;
@@ -375,7 +379,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;
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -106,6 +106,8 @@
# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
// All the regex constants must be distinct and nonzero.
# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
+// Use raw pointers, not wrapped ones, for std::span's iterator type.
+# define _LIBCPP_ABI_SPAN_POINTER_ITERATORS
// Re-worked external template instantiations for std::string with a focus on
// performance and fast-path inlining.
# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101003.341669.patch
Type: text/x-patch
Size: 1718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210429/06f286f7/attachment-0001.bin>
More information about the libcxx-commits
mailing list