2626#include <iterator> // for std::reverse_iterator
2727#include <memory> // for std::allocator
2828#include <detail/string_fwd>
29+ #include <detail/string_view_fwd>
2930
3031namespace std {
3132
@@ -165,6 +166,11 @@ public:
165166 basic_string(std::initializer_list<CharT> init,
166167 const Allocator& alloc = Allocator());
167168#endif
169+ #if CPPREFERENCE_STDVER >= 2017
170+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
171+ // to string_view, but not to const Char*
172+ basic_string(basic_string_view<CharT,Traits> sv, const Allocator& alloc = Allocator());
173+ #endif
168174
169175 ~basic_string();
170176
@@ -175,6 +181,11 @@ public:
175181 basic_string& operator=(basic_string&& other);
176182 basic_string& operator=(initializer_list<CharT> ilist);
177183#endif
184+ #if CPPREFERENCE_STDVER >= 2017
185+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
186+ // to string_view, but not to const Char*
187+ basic_string& operator=(basic_string_view<CharT,Traits> sv);
188+ #endif
178189
179190 basic_string& assign(size_type count, const CharT& ch);
180191 basic_string& assign(const basic_string& str);
@@ -188,6 +199,12 @@ public:
188199 size_type count = npos);
189200#endif
190201
202+ #if CPPREFERENCE_STDVER >= 2017
203+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
204+ // to string_view, but not to const Char*
205+ basic_string& assign(basic_string_view<CharT,Traits> sv);
206+ #endif
207+
191208 basic_string& assign(const CharT* s,
192209 size_type count);
193210
@@ -215,6 +232,9 @@ public:
215232 const_reference at(size_type n) const;
216233 reference operator[](size_type n);
217234 const_reference operator[](size_type n) const;
235+ #if CPPREFERENCE_STDVER >= 2017
236+ operator basic_string_view<CharT, Traits>() const noexcept;
237+ #endif
218238
219239#if CPPREFERENCE_STDVER>= 2011
220240 CharT& front();
@@ -270,6 +290,12 @@ public:
270290 size_type index_str, size_type count = npos);
271291#endif
272292
293+ #if CPPREFERENCE_STDVER >= 2017
294+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
295+ // to string_view, but not to const Char*
296+ basic_string& insert(size_type index, basic_string_view<CharT,Traits> sv);
297+ #endif
298+
273299#if CPPREFERENCE_STDVER <2011
274300 iterator insert(iterator pos, CharT ch);
275301 void insert(iterator pos, size_type count, CharT ch);
@@ -323,6 +349,11 @@ public:
323349 basic_string& append(const basic_string& str,
324350 size_type pos,
325351 size_type count);
352+ #endif
353+ #if CPPREFERENCE_STDVER >= 2017
354+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
355+ // to string_view, but not to const Char*
356+ basic_string& append(basic_string_view<CharT,Traits> sv);
326357#endif
327358 basic_string& append(const CharT* s,
328359 size_type count);
@@ -348,21 +379,33 @@ public:
348379#if CPPREFERENCE_STDVER> 2011
349380 basic_string& operator+=(std::initializer_list<CharT> ilist);
350381#endif
382+ #if CPPREFERENCE_STDVER >= 2017
383+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
384+ // to string_view, but not to const Char*
385+ basic_string& operator+=(basic_string_view<CharT,Traits> sv);
386+ #endif
351387
352388 int compare(const basic_string& str) const;
353389 int compare(size_type pos1, size_type count1,
354390 const basic_string& str) const;
355391
356392#if CPPREFERENCE_STDVER <2014
357393 int compare(size_type pos1, size_type count1,
358-
359394 const basic_string& str,
360395 size_type pos2, size_type count2) const;
361396#else
362397 int compare(size_type pos1, size_type count1,
363398 const basic_string& str,
364399 size_type pos2, size_type count2 = npos) const;
365400#endif
401+ #if CPPREFERENCE_STDVER >= 2017
402+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
403+ // to string_view, but not to const Char*
404+ int compare(basic_string_view<CharT,Traits> sv) const noexcept;
405+ int compare(size_type pos1, size_type count1,
406+ basic_string_view<CharT,Traits> sv) const;
407+ #endif
408+
366409 int compare(const CharT* s) const;
367410 int compare(size_type pos1, size_type count1,
368411 const CharT* s) const;
@@ -382,6 +425,16 @@ public:
382425 size_type pos2, size_type count2 = npos) const;
383426#endif
384427
428+ #if CPPREFERENCE_STDVER >= 2020
429+ bool starts_with(basic_string_view<CharT,Traits> sv) const noexcept;
430+ bool starts_with(CharT c) const noexcept;
431+ bool starts_with(const CharT* s) const;
432+
433+ bool ends_with(basic_string_view<CharT,Traits> sv) const noexcept;
434+ bool ends_with(CharT c) const noexcept;
435+ bool ends_with(const CharT* s) const;
436+ #endif
437+
385438 basic_string& replace(size_type pos, size_type count,
386439 const basic_string& str);
387440 basic_string& replace(const_iterator first, const_iterator last,
@@ -399,6 +452,15 @@ public:
399452 size_type pos2, size_type count2 = npos);
400453#endif
401454
455+ #if CPPREFERENCE_STDVER >= 2017
456+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
457+ // to string_view, but not to const Char*
458+ basic_string& replace(size_type pos, size_type count,
459+ basic_string_view<CharT,Traits> sv);
460+ basic_string& replace(const_iterator first, const_iterator last,
461+ basic_string_view<CharT,Traits> sv);
462+ #endif
463+
402464 template<class InputIt>
403465 basic_string& replace(const_iterator first, const_iterator last,
404466 InputIt first2, InputIt last2);
@@ -448,31 +510,71 @@ public:
448510
449511 // search
450512 size_type find(const basic_string& str, size_type pos = 0) const;
513+
514+ #if CPPREFERENCE_STDVER >= 2017
515+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
516+ // to string_view, but not to const Char*
517+ size_type find(basic_string_view<CharT,Traits> sv,
518+ size_type pos = 0);
519+ #endif
520+
451521 size_type find(const CharT* s, size_type pos, size_type count) const;
452522 size_type find(const CharT* s, size_type pos = 0) const;
453523 size_type find(CharT ch, size_type pos = 0) const;
454524
455525 size_type rfind(const basic_string& str, size_type pos = npos) const;
526+
527+ #if CPPREFERENCE_STDVER >= 2017
528+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
529+ // to string_view, but not to const Char*
530+ size_type rfind(basic_string_view<CharT,Traits> sv,
531+ size_type pos = npos);
532+ #endif
533+
456534 size_type rfind(const CharT* s, size_type pos, size_type count) const;
457535 size_type rfind(const CharT* s, size_type pos = npos) const;
458536 size_type rfind(CharT ch, size_type pos = npos) const;
459537
460538 size_type find_first_of(const basic_string& str, size_type pos = 0) const;
539+ #if CPPREFERENCE_STDVER >= 2017
540+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
541+ // to string_view, but not to const Char*
542+ size_type find_first_of(basic_string_view<CharT,Traits> sv,
543+ size_type pos = 0);
544+ #endif
461545 size_type find_first_of(const CharT* s, size_type pos, size_type count) const;
462546 size_type find_first_of(const CharT* s, size_type pos = 0) const;
463547 size_type find_first_of(CharT ch, size_type pos = 0) const;
464548
465549 size_type find_first_not_of(const basic_string& str, size_type pos = 0) const;
550+ #if CPPREFERENCE_STDVER >= 2017
551+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
552+ // to string_view, but not to const Char*
553+ size_type find_first_not_of(basic_string_view<CharT,Traits> sv,
554+ size_type pos = 0);
555+ #endif
466556 size_type find_first_not_of(const CharT* s, size_type pos, size_type count) const;
467557 size_type find_first_not_of(const CharT* s, size_type pos = 0) const;
468558 size_type find_first_not_of(CharT ch, size_type pos = 0) const;
469559
470560 size_type find_last_of(const basic_string& str, size_type pos = npos) const;
561+ #if CPPREFERENCE_STDVER >= 2017
562+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
563+ // to string_view, but not to const Char*
564+ size_type find_last_of(basic_string_view<CharT,Traits> sv,
565+ size_type pos = npos);
566+ #endif
471567 size_type find_last_of(const CharT* s, size_type pos, size_type count) const;
472568 size_type find_last_of(const CharT* s, size_type pos = npos) const;
473569 size_type find_last_of(CharT ch, size_type pos = npos) const;
474570
475571 size_type find_last_not_of(const basic_string& str, size_type pos = npos) const;
572+ #if CPPREFERENCE_STDVER >= 2017
573+ // SIMPLIFIED: the C++20 standard specifies a template that only accepts types convertible
574+ // to string_view, but not to const Char*
575+ size_type find_last_not_of(basic_string_view<CharT,Traits> sv,
576+ size_type pos = npos);
577+ #endif
476578 size_type find_last_not_of(const CharT* s, size_type pos, size_type count) const;
477579 size_type find_last_not_of(const CharT* s, size_type pos = npos) const;
478580 size_type find_last_not_of(CharT ch, size_type pos = npos) const;
0 commit comments