[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
Mon Oct 21 10:46:21 PDT 2024


================
@@ -309,13 +336,33 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> {
   }
 
   // iterators:
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT { return iterator(data()); }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT {
+#if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
+    return std::__make_static_bounded_iter<0>(data(), data());
----------------
ldionne wrote:

I'm not sure it makes much of a difference, but I still did it because it makes it easier to investigate different representations anyway.

https://github.com/llvm/llvm-project/pull/110729


More information about the libcxx-commits mailing list