[libcxx] [clang] [llvm] [clang-tools-extra] [libc++][span] P2821R5: span.at() (PR #74994)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 10 12:16:42 PST 2023


================
@@ -343,6 +347,15 @@ public:
         return __data_[__idx];
     }
 
+#  if _LIBCPP_STD_VER >= 26
+    _LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+      if (__idx >= size()) {
+        __throw_out_of_range();
+      }
+      return *(data() + __idx);
----------------
philnik777 wrote:

Honestly, that seems really weird to me. Why would you write in in such a convoluted way? This seems like a case where the wording should simply be adjusted to something simpler, or I'm missing something and there is a test missing.

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


More information about the cfe-commits mailing list