[libcxx-commits] [libcxx] [libc++][NFC] Introduce __data() to std::string to replace std::__to_address(__get_pointer()) (PR #178212)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 30 05:31:30 PST 2026


================
@@ -1807,6 +1807,13 @@ public:
   }
 #  endif
 
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* __data() const _NOEXCEPT {
+    return std::__to_address(__get_pointer());
+  }
----------------
philnik777 wrote:

I'd rather have the full API even if it's not used right now than half an API which may lead to confusion in the future.

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


More information about the libcxx-commits mailing list