Implement P0272R1: Give 'std::string' a non-const '.data()' member function
llvm-svn: 262931
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: dd1729fe8a854b79e8d699da61eb749195c1fac5
diff --git a/include/string b/include/string
index 004dc3d..a453779 100644
--- a/include/string
+++ b/include/string
@@ -225,6 +225,7 @@
const value_type* c_str() const noexcept;
const value_type* data() const noexcept;
+ value_type* data() noexcept; // C++17
allocator_type get_allocator() const noexcept;
@@ -1659,6 +1660,10 @@
const value_type* c_str() const _NOEXCEPT {return data();}
_LIBCPP_INLINE_VISIBILITY
const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());}
+#if _LIBCPP_STD_VER > 14
+ _LIBCPP_INLINE_VISIBILITY
+ value_type* data() _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());}
+#endif
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT {return __alloc();}