[libcxx-commits] [libcxx] [libc++][hardening] Use bounded iterators in std::vector and std::string (PR #78929)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 19 10:02:57 PDT 2024
================
@@ -918,11 +926,27 @@ private:
__init_with_sentinel(std::move(__first), std::move(__last));
}
+#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) {
+ return __make_bounded_iter(
+ __wrap_iter<pointer>(__p),
+ __wrap_iter<pointer>(__get_pointer()),
+ __wrap_iter<pointer>(__get_pointer() + size()));
----------------
ldionne wrote:
Let's add a comment explaining why we use `size()` here. I'd like the rationale for using size() vs capacity() explained.
https://github.com/llvm/llvm-project/pull/78929
More information about the libcxx-commits
mailing list