@@ -71,9 +71,7 @@ has to return a reference to a terminator that's within the same array."
7171Personally I'd like `*end()` to be valid, but that's certainly LEWG business
7272requiring a paper."
7373</p >
74- </discussion >
75-
76- <resolution >
74+ <superseded >
7775<p >
7876This wording is relative to <paper num =" N5014" />.
7977</p >
@@ -109,6 +107,100 @@ otherwise, the behavior is undefined</ins>
109107</li >
110108
111109</ol >
110+ </superseded >
111+
112+ <note >2025-11-11; Jonathan provides new wording</note >
113+
114+ </discussion >
115+
116+ <resolution >
117+
118+ <ol >
119+
120+ <li ><p >Modify <sref ref =" [basic.string.general]" /> as indicated:</p >
121+
122+ <blockquote >
123+ <p >-3-
124+ In all cases, [`data()`, `data() + size()`] is a valid range,
125+ `data() + size()` points at an object with value `charT()`
126+ (a "null terminator"), and <tt >size() < = capacity()</tt > is `true`.
127+ <ins >
128+ Non-const access to the null terminator is possible,
129+ e.g. using `*(data()+size())`, but the program has undefined behaviour
130+ if the null terminator is modified to any value other than `charT()`.
131+ </ins >
132+ </p >
133+ </blockquote >
134+ </li >
135+
136+ <li ><p >Modify <sref ref =" [string.access]" /> as indicated:</p >
137+
138+ <blockquote >
139+ <pre >
140+ constexpr const_reference operator[](size_type pos) const;
141+ constexpr reference operator[](size_type pos);
142+ </pre >
143+ <blockquote >
144+ <p >-1- <i >Hardened Preconditions</i >: <tt >pos < = size()</tt > is `true`.</p >
145+ <p >-2- <i >Returns</i >:
146+ <ins >`*(data() + pos)`.</ins >
147+ <del >
148+ `*(begin() + pos)` if <tt >pos < size()</tt >.
149+ Otherwise, returns a reference to an object of type `charT`
150+ with value `charT()`,
151+ where modifying the object to any value other than `charT()`
152+ leads to undefined behavior.
153+ </del >
154+ </p >
155+ <p >-3- <i >Throws</i >: Nothing.</p >
156+ <p >-4- <i >Complexity</i >: Constant time.</p >
157+ </blockquote >
158+ </blockquote >
159+ </li >
160+
161+ <li ><p >Modify <sref ref =" [string.accessors]" /> as indicated:</p >
162+
163+ <blockquote >
164+ <pre >
165+ constexpr const charT* c_str() const noexcept;
166+ constexpr const charT* data() const noexcept;
167+ <ins >constexpr charT* data() noexcept;</ins >
168+ </pre >
169+ <blockquote >
170+ <p >-1- <i >Returns</i >:
171+ <ins >`std::to_address(begin())`.</ins >
172+ <del >
173+ A pointer `p` such that `p + i == addressof(operator[](i))`
174+ for each `i` in [`0`, `size()`].
175+ </del >
176+ </p >
177+ <p >-2- <i >Complexity</i >: Constant time.</p >
178+ <p ><del >-3- <i >Remarks</i >:
179+ The program shall not modify any of the values stored in the character array;
180+ otherwise, the behavior is undefined.</del >
181+ </p >
182+ </blockquote >
183+
184+ <pre >
185+ <del >constexpr charT* data() noexcept;</del >
186+ </pre >
187+ <blockquote >
188+ <p ><del >-4- <i >Returns</i >:
189+ A pointer `p` such that `p + i == addressof(operator[](i))`
190+ for each `i` in [`0`, `size()`].
191+ </del >
192+ </p >
193+ <p ><del >-5- <i >Complexity</i >: Constant time.</del ></p >
194+ <p ><del >-6- <i >Remarks</i >:
195+ The program shall not modify the value stored at `p + size()` to any
196+ value other than `charT()`; otherwise, the behavior is undefined.</del >
197+ </p >
198+ </blockquote >
199+
200+ </blockquote >
201+ </li >
202+ </ol >
203+
112204</resolution >
113205
114206</issue >
0 commit comments