[libcxx-commits] [libcxx] [libc++] Add support for bounded iterators in std::array (PR #110729)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 2 05:51:02 PDT 2024
================
@@ -176,6 +176,12 @@
// ABI impact: changes the iterator type of `vector` (except `vector<bool>`).
// #define _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
+// Changes the iterator type of `array` to a bounded iterator that keeps track of whether it's within the bounds of the
+// container and asserts it on every dereference and when performing iterator arithmetic.
+//
+// ABI impact: changes the iterator type of `array`.
+// #define _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY
----------------
ldionne wrote:
We have to store the beginning of the array in addition to the pointer into the array itself. So there is in fact a downside (performance wise) to enabling this ABI configuration. My preference would be to be consistent with other similar ABI settings for hardening and *not* enable them by default in ABI v2.
https://github.com/llvm/llvm-project/pull/110729
More information about the libcxx-commits
mailing list