Implement P0272R1: Give 'std::string' a non-const '.data()' member function

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@262931 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2016-03-08 15:44:30 +00:00
parent f6d6b51b63
commit f532a70b63
3 changed files with 42 additions and 11 deletions

View File

@@ -225,6 +225,7 @@ public:
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 @@ public:
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();}