Skip to content

Commit 9d7581a

Browse files
burblebeetkoeppe
authored andcommitted
LWG3662 basic_string::append/assign(NTBS, pos, n) suboptimal
Fixes NB RU 268 (C++26 CD).
1 parent cc902d3 commit 9d7581a

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

source/strings.tex

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,6 +2153,7 @@
21532153
constexpr basic_string& append(const T& t, size_type pos, size_type n = npos);
21542154
constexpr basic_string& append(const charT* s, size_type n);
21552155
constexpr basic_string& append(const charT* s);
2156+
constexpr basic_string& append(const charT* s, size_type pos, size_type n);
21562157
constexpr basic_string& append(size_type n, charT c);
21572158
template<class InputIterator>
21582159
constexpr basic_string& append(InputIterator first, InputIterator last);
@@ -2173,6 +2174,7 @@
21732174
constexpr basic_string& assign(const T& t, size_type pos, size_type n = npos);
21742175
constexpr basic_string& assign(const charT* s, size_type n);
21752176
constexpr basic_string& assign(const charT* s);
2177+
constexpr basic_string& assign(const charT* s, size_type pos, size_type n);
21762178
constexpr basic_string& assign(size_type n, charT c);
21772179
template<class InputIterator>
21782180
constexpr basic_string& assign(InputIterator first, InputIterator last);
@@ -3353,6 +3355,18 @@
33533355
Equivalent to: \tcode{return append(s, traits::length(s));}
33543356
\end{itemdescr}
33553357

3358+
\indexlibrarymember{append}{basic_string}%
3359+
\begin{itemdecl}
3360+
constexpr basic_string& append(const charT* s, size_type pos, size_type n);
3361+
\end{itemdecl}
3362+
3363+
\begin{itemdescr}
3364+
\pnum
3365+
\effects
3366+
Equivalent to:
3367+
\tcode{return append(basic_string_view<charT, traits>(s).substr(pos, n));}
3368+
\end{itemdescr}
3369+
33563370
\indexlibrarymember{append}{basic_string}%
33573371
\begin{itemdecl}
33583372
constexpr basic_string& append(size_type n, charT c);
@@ -3546,6 +3560,18 @@
35463560
Equivalent to: \tcode{return assign(s, traits::length(s));}
35473561
\end{itemdescr}
35483562

3563+
\indexlibrarymember{assign}{basic_string}%
3564+
\begin{itemdecl}
3565+
constexpr basic_string& assign(const charT* s, size_type pos, size_type n);
3566+
\end{itemdecl}
3567+
3568+
\begin{itemdescr}
3569+
\pnum
3570+
\effects
3571+
Equivalent to:
3572+
\tcode{return assign(basic_string_view<charT, traits>(s).substr(pos, n));}
3573+
\end{itemdescr}
3574+
35493575
\indexlibrarymember{assign}{basic_string}%
35503576
\begin{itemdecl}
35513577
constexpr basic_string& assign(initializer_list<charT> il);

0 commit comments

Comments
 (0)