[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:56 PDT 2024
================
@@ -798,10 +806,30 @@ private:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x);
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator __make_iter(pointer __p) _NOEXCEPT {
+#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ // Bound the iterator according to the capacity, rather than the size.
+ // Resizing a vector up to the capacity will not invalidate iterators, so,
+ // Without a way to update all live iterators on resize, we must
----------------
ldionne wrote:
```suggestion
// Resizing a vector up to the capacity will not invalidate iterators, so
// without a way to update all live iterators on resize, we must
```
https://github.com/llvm/llvm-project/pull/78929
More information about the libcxx-commits
mailing list