[libcxx-commits] [libcxx] [libc++][string] P3044R2: sub-`string_view` from `string` (PR #147095)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 22 00:09:41 PDT 2025


================
@@ -1763,6 +1765,13 @@ public:
   }
 #  endif
 
+#  if _LIBCPP_STD_VER >= 26
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT, _Traits>
+  subview(size_type __pos = 0, size_type __n = npos) const {
+    return basic_string_view<_CharT, _Traits>(*this).subview(__pos, __n);
+  }
+#  endif
----------------
philnik777 wrote:

```suggestion
#  if _LIBCPP_STD_VER >= 26
  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __self_view
  subview(size_type __pos = 0, size_type __n = npos) const {
    return __self_view(*this).subview(__pos, __n);
  }
#  endif
```

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


More information about the libcxx-commits mailing list