---
name: "__gnu_debug::basic_string"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_debug::basic_string/3cxx"
---

# \_\_gnu\_debug::basic\_string(3cxx)

Class std::basic\_string with safety/checking/debug instrumentation.

## NAME

\_\_gnu\_debug::basic\_string\< \_CharT, \_Traits, \_Allocator \> - Class std::basic\_string with safety/checking/debug instrumentation.

## SYNOPSIS

`#include <string>`

Inherits **\_\_gnu\_debug::\_Safe\_container\< \_SafeContainer, \_Alloc, \_SafeBase, \_IsCxx11AllocatorAware \>**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>**.

### Public Types

typedef \_Allocator **allocator\_type**\
 typedef **\_\_gnu\_debug::\_Safe\_iterator**\< typename \_Base::const\_iterator, **basic\_string** \> **const\_iterator**\
 typedef \_Base::const\_pointer **const\_pointer**\
 typedef \_Base::const\_reference **const\_reference**\
 typedef **std::reverse\_iterator**\< **const\_iterator** \> **const\_reverse\_iterator**\
 typedef \_Base::difference\_type **difference\_type**\
 typedef **\_\_gnu\_debug::\_Safe\_iterator**\< typename \_Base::iterator, **basic\_string** \> **iterator**\
 typedef **\_Base::pointer** **pointer**\
 typedef \_Base::reference **reference**\
 typedef **std::reverse\_iterator**\< **iterator** \> **reverse\_iterator**\
 typedef \_Base::size\_type **size\_type**\
 typedef \_Traits **traits\_type**\
 typedef \_Traits::char\_type **value\_type**\

### Public Member Functions

**basic\_string** (**\_Base** &&**\_\_base**) noexcept\
 template\<typename \_InputIterator \> **basic\_string** (\_InputIterator \_\_begin, \_InputIterator \_\_end, const \_Allocator &\_\_a=\_Allocator())\
 **basic\_string** (**basic\_string** &&)=default\
 **basic\_string** (**basic\_string** &&\_\_s, const \_Allocator &\_\_a) noexcept(**std::is\_nothrow\_constructible**\< **\_Base**, **\_Base**, const \_Allocator & \>::value)\
 **basic\_string** (const \_Allocator &\_\_a) noexcept\
 **basic\_string** (const **\_Base** &**\_\_base**)\
 **basic\_string** (const \_CharT \*\_\_s, const \_Allocator &\_\_a=\_Allocator())\
 **basic\_string** (const \_CharT \*\_\_s, size\_type \_\_n, const \_Allocator &\_\_a=\_Allocator())\
 **basic\_string** (const **basic\_string** &)=default\
 **basic\_string** (const **basic\_string** &\_\_s, const \_Allocator &\_\_a)\
 **basic\_string** (const **basic\_string** &\_\_str, size\_type \_\_pos, size\_type \_\_n=**\_Base::npos**, const \_Allocator &\_\_a=\_Allocator())\
 **basic\_string** (size\_type \_\_n, \_CharT \_\_c, const \_Allocator &\_\_a=\_Allocator())\
 **basic\_string** (**std::initializer\_list**\< \_CharT \> \_\_l, const \_Allocator &\_\_a=\_Allocator())\
 const **\_Base** & **\_M\_base** () const noexcept\
 **\_Base** & **\_M\_base** () noexcept\
 template\<typename \_InputIterator \> **basic\_string**\< \_CharT, \_Traits, \_Alloc \> & **\_M\_replace\_dispatch** (**iterator** \_\_i1, **iterator** \_\_i2, \_InputIterator \_\_k1, \_InputIterator \_\_k2, \_\_false\_type)\
 template\<typename \_InIterator \> \_CharT \* **\_S\_construct** (\_InIterator \_\_beg, \_InIterator \_\_end, const \_Alloc &\_\_a, forward\_iterator\_tag)\
 template\<typename \_InputIterator \> **basic\_string** & **append** (\_InputIterator \_\_first, \_InputIterator \_\_last)\
 **basic\_string** & **append** (const \_CharT \*\_\_s)\
 **basic\_string** & **append** (const \_CharT \*\_\_s, size\_type \_\_n)\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **append** (const \_Tp &\_\_svt)\
 Append a string\_view.  template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **append** (const \_Tp &\_\_svt, size\_type \_\_pos, size\_type \_\_n=**npos**)\
 Append a range of characters from a string\_view.  **basic\_string** & **append** (const **basic\_string** &\_\_str)\
 Append a string to this string.  **basic\_string** & **append** (const **basic\_string** &\_\_str)\
 **basic\_string** & **append** (const **basic\_string** &\_\_str, size\_type \_\_pos, size\_type \_\_n)\
 **basic\_string** & **append** (const **basic\_string** &\_\_str, size\_type \_\_pos, size\_type \_\_n=**npos**)\
 Append a substring.  **basic\_string** & **append** (initializer\_list\< \_CharT \> \_\_l)\
 Append an initializer\_list of characters.  **basic\_string** & **append** (size\_type \_\_n, \_CharT \_\_c)\
 template\<typename \_InputIterator \> **basic\_string** & **assign** (\_InputIterator \_\_first, \_InputIterator \_\_last)\
 **basic\_string** & **assign** (**basic\_string** &&\_\_str) noexcept(allocator\_traits\< \_Alloc \>::is\_always\_equal::value)\
 Set value to contents of another string.  **basic\_string** & **assign** (**basic\_string** &&\_\_x) noexcept(noexcept(**std::declval**\< **\_Base** & \>().assign(**std::move**(\_\_x))))\
 **basic\_string** & **assign** (const \_CharT \*\_\_s)\
 **basic\_string** & **assign** (const \_CharT \*\_\_s, size\_type \_\_n)\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **assign** (const \_Tp &\_\_svt)\
 Set value from a string\_view.  template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **assign** (const \_Tp &\_\_svt, size\_type \_\_pos, size\_type \_\_n=**npos**)\
 Set value from a range of characters in a string\_view.  **basic\_string** & **assign** (const **basic\_string** &\_\_str)\
 Set value to contents of another string.  **basic\_string** & **assign** (const **basic\_string** &\_\_str, size\_type \_\_pos, size\_type \_\_n)\
 **basic\_string** & **assign** (const **basic\_string** &\_\_str, size\_type \_\_pos, size\_type \_\_n=**npos**)\
 Set value to a substring of a string.  **basic\_string** & **assign** (const **basic\_string** &\_\_x)\
 **basic\_string** & **assign** (size\_type \_\_n, \_CharT \_\_c)\
 **basic\_string** & **assign** (**std::initializer\_list**\< \_CharT \> \_\_l)\
 reference **at** (size\_type \_\_n)\
 Provides access to the data contained in the string.  const\_reference **at** (size\_type \_\_n) const\
 Provides access to the data contained in the string.  reference **back** ()\
 const\_reference **back** () const noexcept\
 **iterator** **begin** ()\
 **const\_iterator** **begin** () const noexcept\
 const \_CharT \* **c\_str** () const noexcept\
 size\_type **capacity** () const noexcept\
 **const\_iterator** **cbegin** () const noexcept\
 **const\_iterator** **cend** () const noexcept\
 void **clear** ()\
 int **compare** (const \_CharT \*\_\_s) const\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, int \> **compare** (const \_Tp &\_\_svt) const noexcept(is\_same\< \_Tp, **\_\_sv\_type** \>::value)\
 Compare to a string\_view.  int **compare** (const **basic\_string** &\_\_str) const\
 Compare to a string.  int **compare** (const **basic\_string** &\_\_str) const\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, int \> **compare** (size\_type \_\_pos, size\_type \_\_n, const \_Tp &\_\_svt) const noexcept(is\_same\< \_Tp, **\_\_sv\_type** \>::value)\
 Compare to a string\_view.  int **compare** (size\_type \_\_pos, size\_type \_\_n, const **basic\_string** &\_\_str) const\
 Compare substring to a string.  int **compare** (size\_type \_\_pos1, size\_type \_\_n1, const \_CharT \*\_\_s) const\
 int **compare** (size\_type \_\_pos1, size\_type \_\_n1, const \_CharT \*\_\_s, size\_type \_\_n2) const\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, int \> **compare** (size\_type \_\_pos1, size\_type \_\_n1, const \_Tp &\_\_svt, size\_type \_\_pos2, size\_type \_\_n2=**npos**) const noexcept(is\_same\< \_Tp, **\_\_sv\_type** \>::value)\
 Compare to a string\_view.  int **compare** (size\_type \_\_pos1, size\_type \_\_n1, const **basic\_string** &\_\_str) const\
 int **compare** (size\_type \_\_pos1, size\_type \_\_n1, const **basic\_string** &\_\_str, size\_type \_\_pos2, size\_type \_\_n2) const\
 int **compare** (size\_type \_\_pos1, size\_type \_\_n1, const **basic\_string** &\_\_str, size\_type \_\_pos2, size\_type \_\_n2=**npos**) const\
 Compare substring to a substring.  size\_type **copy** (\_CharT \*\_\_s, size\_type \_\_n, size\_type \_\_pos=0) const\
 **const\_reverse\_iterator** **crbegin** () const noexcept\
 **const\_reverse\_iterator** **crend** () const noexcept\
 const \_CharT \* **data** () const noexcept\
 \_CharT \* **data** () noexcept\
 Return non-const pointer to contents.  bool **empty** () const noexcept\
 **iterator** **end** ()\
 **const\_iterator** **end** () const noexcept\
 bool **ends\_with** (\_CharT \_\_x) const noexcept\
 bool **ends\_with** (basic\_string\_view\< \_CharT, \_Traits \> \_\_x) const noexcept\
 bool **ends\_with** (const \_CharT \*\_\_x) const noexcept\
 **iterator** **erase** (**\_\_const\_iterator** \_\_first, **\_\_const\_iterator** \_\_last)\
 **iterator** **erase** (**\_\_const\_iterator** \_\_position)\
 **iterator** **erase** (**iterator** \_\_first, **iterator** \_\_last)\
 Remove a range of characters.  **iterator** **erase** (**iterator** \_\_position)\
 Remove one character.  **basic\_string** & **erase** (size\_type \_\_pos=0, size\_type \_\_n=**\_Base::npos**)\
 size\_type **find** (\_CharT \_\_c, size\_type \_\_pos=0) const noexcept\
 size\_type **find** (const \_CharT \*\_\_s, size\_type \_\_pos, size\_type \_\_n) const\
 size\_type **find** (const \_CharT \*\_\_s, size\_type \_\_pos=0) const\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, size\_type \> **find** (const \_Tp &\_\_svt, size\_type \_\_pos=0) const noexcept(is\_same\< \_Tp, **\_\_sv\_type** \>::value)\
 Find position of a string\_view.  size\_type **find** (const **basic\_string** &\_\_str, size\_type \_\_pos=0) const noexcept\
 Find position of a string.  size\_type **find** (const **basic\_string** &\_\_str, size\_type \_\_pos=0) const noexcept\
 size\_type **find\_first\_not\_of** (\_CharT \_\_c, size\_type \_\_pos=0) const noexcept\
 size\_type **find\_first\_not\_of** (const \_CharT \*\_\_s, size\_type \_\_pos, size\_type \_\_n) const\
 size\_type **find\_first\_not\_of** (const \_CharT \*\_\_s, size\_type \_\_pos=0) const\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, size\_type \> **find\_first\_not\_of** (const \_Tp &\_\_svt, size\_type \_\_pos=0) const noexcept(is\_same\< \_Tp, **\_\_sv\_type** \>::value)\
 Find position of a character not in a string\_view.  size\_type **find\_first\_not\_of** (const **basic\_string** &\_\_str, size\_type \_\_pos=0) const noexcept\
 Find position of a character not in string.  size\_type **find\_first\_not\_of** (const **basic\_string** &\_\_str, size\_type \_\_pos=0) const noexcept\
 size\_type **find\_first\_of** (\_CharT \_\_c, size\_type \_\_pos=0) const noexcept\
 size\_type **find\_first\_of** (const \_CharT \*\_\_s, size\_type \_\_pos, size\_type \_\_n) const\
 size\_type **find\_first\_of** (const \_CharT \*\_\_s, size\_type \_\_pos=0) const\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, size\_type \> **find\_first\_of** (const \_Tp &\_\_svt, size\_type \_\_pos=0) const noexcept(is\_same\< \_Tp, **\_\_sv\_type** \>::value)\
 Find position of a character of a string\_view.  size\_type **find\_first\_of** (const **basic\_string** &\_\_str, size\_type \_\_pos=0) const noexcept\
 Find position of a character of string.  size\_type **find\_first\_of** (const **basic\_string** &\_\_str, size\_type \_\_pos=0) const noexcept\
 size\_type **find\_last\_not\_of** (\_CharT \_\_c, size\_type \_\_pos=**\_Base::npos**) const noexcept\
 size\_type **find\_last\_not\_of** (const \_CharT \*\_\_s, size\_type \_\_pos, size\_type \_\_n) const\
 size\_type **find\_last\_not\_of** (const \_CharT \*\_\_s, size\_type \_\_pos=**\_Base::npos**) const\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, size\_type \> **find\_last\_not\_of** (const \_Tp &\_\_svt, size\_type \_\_pos=**npos**) const noexcept(is\_same\< \_Tp, **\_\_sv\_type** \>::value)\
 Find last position of a character not in a string\_view.  size\_type **find\_last\_not\_of** (const **basic\_string** &\_\_str, size\_type \_\_pos=**\_Base::npos**) const noexcept\
 size\_type **find\_last\_not\_of** (const **basic\_string** &\_\_str, size\_type \_\_pos=**npos**) const noexcept\
 Find last position of a character not in string.  size\_type **find\_last\_of** (\_CharT \_\_c, size\_type \_\_pos=**\_Base::npos**) const noexcept\
 size\_type **find\_last\_of** (const \_CharT \*\_\_s, size\_type \_\_pos, size\_type \_\_n) const\
 size\_type **find\_last\_of** (const \_CharT \*\_\_s, size\_type \_\_pos=**\_Base::npos**) const\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, size\_type \> **find\_last\_of** (const \_Tp &\_\_svt, size\_type \_\_pos=**npos**) const noexcept(is\_same\< \_Tp, **\_\_sv\_type** \>::value)\
 Find last position of a character of string.  size\_type **find\_last\_of** (const **basic\_string** &\_\_str, size\_type \_\_pos=**\_Base::npos**) const noexcept\
 size\_type **find\_last\_of** (const **basic\_string** &\_\_str, size\_type \_\_pos=**npos**) const noexcept\
 Find last position of a character of string.  reference **front** ()\
 const\_reference **front** () const noexcept\
 allocator\_type **get\_allocator** () const noexcept\
 Return copy of allocator used to construct this string.  **iterator** **insert** (**\_\_const\_iterator** \_\_p, \_CharT \_\_c)\
 template\<typename \_InputIterator \> **iterator** **insert** (**\_\_const\_iterator** \_\_p, \_InputIterator \_\_first, \_InputIterator \_\_last)\
 **iterator** **insert** (**const\_iterator** \_\_p, size\_type \_\_n, \_CharT \_\_c)\
 **iterator** **insert** (**const\_iterator** \_\_p, **std::initializer\_list**\< \_CharT \> \_\_l)\
 **iterator** **insert** (**iterator** \_\_p, \_CharT \_\_c)\
 Insert one character.  template\<class \_InputIterator \> void **insert** (**iterator** \_\_p, \_InputIterator \_\_beg, \_InputIterator \_\_end)\
 Insert a range of characters.  void **insert** (**iterator** \_\_p, initializer\_list\< \_CharT \> \_\_l)\
 Insert an initializer\_list of characters.  void **insert** (**iterator** \_\_p, size\_type \_\_n, \_CharT \_\_c)\
 Insert multiple characters.  **basic\_string** & **insert** (size\_type \_\_pos, const \_CharT \*\_\_s)\
 **basic\_string** & **insert** (size\_type \_\_pos, const \_CharT \*\_\_s, size\_type \_\_n)\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **insert** (size\_type \_\_pos, const \_Tp &\_\_svt)\
 Insert a string\_view.  **basic\_string** & **insert** (size\_type \_\_pos, size\_type \_\_n, \_CharT \_\_c)\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **insert** (size\_type \_\_pos1, const \_Tp &\_\_svt, size\_type \_\_pos2, size\_type \_\_n=**npos**)\
 Insert a string\_view.  **basic\_string** & **insert** (size\_type \_\_pos1, const **basic\_string** &\_\_str)\
 Insert value of a string.  **basic\_string** & **insert** (size\_type \_\_pos1, const **basic\_string** &\_\_str)\
 **basic\_string** & **insert** (size\_type \_\_pos1, const **basic\_string** &\_\_str, size\_type \_\_pos2, size\_type \_\_n)\
 **basic\_string** & **insert** (size\_type \_\_pos1, const **basic\_string** &\_\_str, size\_type \_\_pos2, size\_type \_\_n=**npos**)\
 Insert a substring.  size\_type **length** () const noexcept\
 Returns the number of characters in the string, not including any null-termination.  size\_type **max\_size** () const noexcept\
 Returns the size() of the largest possible string.  **operator \_\_sv\_type** () const noexcept\
 Convert to a string\_view.  **basic\_string** & **operator+=** (\_CharT \_\_c)\
 **basic\_string** & **operator+=** (const \_CharT \*\_\_s)\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **operator+=** (const \_Tp &\_\_svt)\
 Append a string\_view.  **basic\_string** & **operator+=** (const **basic\_string** &\_\_str)\
 Append a string to this string.  **basic\_string** & **operator+=** (const **basic\_string** &\_\_str)\
 **basic\_string** & **operator+=** (**std::initializer\_list**\< \_CharT \> \_\_l)\
 **basic\_string** & **operator=** (\_CharT \_\_c)\
 **basic\_string** & **operator=** (**basic\_string** &&)=default\
 **basic\_string** & **operator=** (const \_CharT \*\_\_s)\
 **basic\_string** & **operator=** (const **basic\_string** &)=default\
 **basic\_string** & **operator=** (**std::initializer\_list**\< \_CharT \> \_\_l)\
 reference **operator\[\]** (size\_type \_\_pos)\
 const\_reference **operator\[\]** (size\_type \_\_pos) const noexcept\
 void **pop\_back** ()\
 void **push\_back** (\_CharT \_\_c)\
 **reverse\_iterator** **rbegin** ()\
 **const\_reverse\_iterator** **rbegin** () const noexcept\
 **reverse\_iterator** **rend** ()\
 **const\_reverse\_iterator** **rend** () const noexcept\
 template\<typename \_InputIterator \> **basic\_string** & **replace** (**\_\_const\_iterator** \_\_i1, **\_\_const\_iterator** \_\_i2, \_InputIterator \_\_j1, \_InputIterator \_\_j2)\
 **basic\_string** & **replace** (**\_\_const\_iterator** \_\_i1, **\_\_const\_iterator** \_\_i2, const \_CharT \*\_\_s)\
 **basic\_string** & **replace** (**\_\_const\_iterator** \_\_i1, **\_\_const\_iterator** \_\_i2, const \_CharT \*\_\_s, size\_type \_\_n)\
 **basic\_string** & **replace** (**\_\_const\_iterator** \_\_i1, **\_\_const\_iterator** \_\_i2, const **basic\_string** &\_\_str)\
 **basic\_string** & **replace** (**\_\_const\_iterator** \_\_i1, **\_\_const\_iterator** \_\_i2, size\_type \_\_n, \_CharT \_\_c)\
 **basic\_string** & **replace** (**\_\_const\_iterator** \_\_i1, **\_\_const\_iterator** \_\_i2, **std::initializer\_list**\< \_CharT \> \_\_l)\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **replace** (**const\_iterator** \_\_i1, **const\_iterator** \_\_i2, const \_Tp &\_\_svt)\
 Replace range of characters with string\_view.  **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, \_CharT \*\_\_k1, \_CharT \*\_\_k2)\
 template\<class \_InputIterator \> **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, \_InputIterator \_\_k1, \_InputIterator \_\_k2)\
 Replace range of characters with range.  **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, const \_CharT \*\_\_k1, const \_CharT \*\_\_k2)\
 **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, const \_CharT \*\_\_s)\
 Replace range of characters with C string.  **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, const \_CharT \*\_\_s, size\_type \_\_n)\
 Replace range of characters with C substring.  **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, const **basic\_string** &\_\_str)\
 Replace range of characters with string.  **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, **const\_iterator** \_\_k1, **const\_iterator** \_\_k2)\
 **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, initializer\_list\< \_CharT \> \_\_l)\
 Replace range of characters with initializer\_list.  **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, **iterator** \_\_k1, **iterator** \_\_k2)\
 **basic\_string** & **replace** (**iterator** \_\_i1, **iterator** \_\_i2, size\_type \_\_n, \_CharT \_\_c)\
 Replace range of characters with multiple characters.  template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **replace** (size\_type \_\_pos, size\_type \_\_n, const \_Tp &\_\_svt)\
 Replace range of characters with string\_view.  **basic\_string** & **replace** (size\_type \_\_pos, size\_type \_\_n, const **basic\_string** &\_\_str)\
 Replace characters with value from another string.  **basic\_string** & **replace** (size\_type \_\_pos, size\_type \_\_n1, const \_CharT \*\_\_s)\
 **basic\_string** & **replace** (size\_type \_\_pos, size\_type \_\_n1, const \_CharT \*\_\_s, size\_type \_\_n2)\
 **basic\_string** & **replace** (size\_type \_\_pos, size\_type \_\_n1, size\_type \_\_n2, \_CharT \_\_c)\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, **basic\_string** & \> **replace** (size\_type \_\_pos1, size\_type \_\_n1, const \_Tp &\_\_svt, size\_type \_\_pos2, size\_type \_\_n2=**npos**)\
 Replace range of characters with string\_view.  **basic\_string** & **replace** (size\_type \_\_pos1, size\_type \_\_n1, const **basic\_string** &\_\_str)\
 **basic\_string** & **replace** (size\_type \_\_pos1, size\_type \_\_n1, const **basic\_string** &\_\_str, size\_type \_\_pos2, size\_type \_\_n2)\
 **basic\_string** & **replace** (size\_type \_\_pos1, size\_type \_\_n1, const **basic\_string** &\_\_str, size\_type \_\_pos2, size\_type \_\_n2=**npos**)\
 Replace characters with value from another string.  void **reserve** ()\
 Equivalent to shrink\_to\_fit().  void **reserve** (size\_type \_\_res\_arg)\
 Attempt to preallocate enough memory for specified number of characters.  void **resize** (size\_type \_\_n)\
 void **resize** (size\_type \_\_n, \_CharT \_\_c)\
 size\_type **rfind** (\_CharT \_\_c, size\_type \_\_pos=**\_Base::npos**) const noexcept\
 size\_type **rfind** (const \_CharT \*\_\_s, size\_type \_\_pos, size\_type \_\_n) const\
 size\_type **rfind** (const \_CharT \*\_\_s, size\_type \_\_pos=**\_Base::npos**) const\
 template\<typename \_Tp \> **\_If\_sv**\< \_Tp, size\_type \> **rfind** (const \_Tp &\_\_svt, size\_type \_\_pos=**npos**) const noexcept(is\_same\< \_Tp, **\_\_sv\_type** \>::value)\
 Find last position of a string\_view.  size\_type **rfind** (const **basic\_string** &\_\_str, size\_type \_\_pos=**\_Base::npos**) const noexcept\
 size\_type **rfind** (const **basic\_string** &\_\_str, size\_type \_\_pos=**npos**) const noexcept\
 Find last position of a string.  void **shrink\_to\_fit** () noexcept\
 size\_type **size** () const noexcept\
 Returns the number of characters in the string, not including any null-termination.  bool **starts\_with** (\_CharT \_\_x) const noexcept\
 bool **starts\_with** (basic\_string\_view\< \_CharT, \_Traits \> \_\_x) const noexcept\
 bool **starts\_with** (const \_CharT \*\_\_x) const noexcept\
 **basic\_string** **substr** (size\_type \_\_pos=0, size\_type \_\_n=**\_Base::npos**) const\
 void **swap** (**basic\_string** &\_\_s) noexcept(/\*conditional \*/)\
 Swap contents with another string.  void **swap** (**basic\_string** &\_\_x) noexcept(/\*conditional \*/)\

### Static Public Attributes

static const size\_type **npos**\
 Value returned by various member functions when they fail.

### Protected Member Functions

void **\_M\_swap** (**\_Safe\_container** &\_\_x) noexcept\

### Friends

template\<typename \_ItT , typename \_SeqT , typename \_CatT \> class **::\_\_gnu\_debug::\_Safe\_iterator**\

## Detailed Description

### template\<typename \_CharT, typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\>

class \_\_gnu\_debug::basic\_string\< \_CharT, \_Traits, \_Allocator \>"Class std::basic\_string with safety/checking/debug instrumentation.

## Member Function Documentation

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append (const \_Tp & \_\_svt)` [inline]`, ` [inherited]`

Append a string\_view.

**Parameters**

*\_\_svt* The object convertible to string\_view to be appended.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append (const \_Tp & \_\_svt, size\_type \_\_pos, size\_type \_\_n = npos)` [inline]`, ` [inherited]`

Append a range of characters from a string\_view.

**Parameters**

*\_\_svt* The object convertible to string\_view to be appended from. \
 *\_\_pos* The position in the string\_view to append from. \
 *\_\_n* The number of characters to append from the string\_view.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string\< \_CharT, \_Traits, \_Alloc \> & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str)` [inherited]`

Append a string to this string.

**Parameters**

*\_\_str* The string to append.

**Returns**

Reference to this string.

References **std::size()**.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator+=()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator+=()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator+=()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator+=()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string\< \_CharT, \_Traits, \_Alloc \> & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos, size\_type \_\_n = npos)` [inherited]`

Append a substring.

**Parameters**

*\_\_str* The string to append. \
 *\_\_pos* Index of the first character of str to append. \
 *\_\_n* The number of characters to append.

**Returns**

Reference to this string.

**Exceptions**

*std::out\_of\_range* if *\_\_pos* is not a valid index.

This function appends *\_\_n* characters from *\_\_str* starting at *\_\_pos* to this string. If *\_\_n* is is larger than the number of available characters in *\_\_str*, the remainder of *\_\_str* is appended.

References **std::size()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append (initializer\_list\< \_CharT \> \_\_l)` [inline]`, ` [inherited]`

Append an initializer\_list of characters.

**Parameters**

*\_\_l* The initializer\_list of characters to append.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign (basic\_string\< \_CharT, \_Traits, \_Alloc \> && \_\_str)` [inline]`, ` [noexcept]`, ` [inherited]`

Set value to contents of another string.

**Parameters**

*\_\_str* Source string to use.

**Returns**

Reference to this string.

This function sets this string to the exact contents of *\_\_str*. *\_\_str* is a valid, but unspecified string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::swap()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign (const \_Tp & \_\_svt)` [inline]`, ` [inherited]`

Set value from a string\_view.

**Parameters**

*\_\_svt* The source object convertible to string\_view.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign (const \_Tp & \_\_svt, size\_type \_\_pos, size\_type \_\_n = npos)` [inline]`, ` [inherited]`

Set value from a range of characters in a string\_view.

**Parameters**

*\_\_svt* The source object convertible to string\_view. \
 *\_\_pos* The position in the string\_view to assign from. \
 *\_\_n* The number of characters to assign.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string\< \_CharT, \_Traits, \_Alloc \> & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str)` [inherited]`

Set value to contents of another string.

**Parameters**

*\_\_str* Source string to use.

**Returns**

Reference to this string.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator=()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator=()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator=()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator=()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator=()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos, size\_type \_\_n = npos)` [inline]`, ` [inherited]`

Set value to a substring of a string.

**Parameters**

*\_\_str* The string to use. \
 *\_\_pos* Index of the first character of str. \
 *\_\_n* Number of characters to use.

**Returns**

Reference to this string.

**Exceptions**

*std::out\_of\_range* if *pos* is not a valid index.

This function sets this string to the substring of *\_\_str* consisting of *\_\_n* characters at *\_\_pos*. If *\_\_n* is is larger than the number of available characters in *\_\_str*, the remainder of *\_\_str* is used.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> reference std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::at (size\_type \_\_n)` [inline]`

Provides access to the data contained in the string.

**Parameters**

*\_\_n* The index of the character to access.

**Returns**

Read/write reference to the character.

**Exceptions**

*std::out\_of\_range* If *n* is an invalid index.

This function provides for safer data access. The parameter is first checked that it is in the range of the string. The function throws out\_of\_range if the check fails. Success results in unsharing the string.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> const\_reference std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::at (size\_type \_\_n) const` [inline]`

Provides access to the data contained in the string.

**Parameters**

*\_\_n* The index of the character to access.

**Returns**

Read-only (const) reference to the character.

**Exceptions**

*std::out\_of\_range* If *n* is an invalid index.

This function provides for safer data access. The parameter is first checked that it is in the range of the string. The function throws out\_of\_range if the check fails.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> reference std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::back ()` [inline]`

Returns a read/write reference to the data at the last element of the string.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> const\_reference std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::back () const` [inline]`, ` [noexcept]`

Returns a read-only (constant) reference to the data at the last element of the string.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::capacity () const` [inline]`, ` [noexcept]`

Returns the total number of characters that the string can hold before needing to allocate more memory.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, int \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::compare (const \_Tp & \_\_svt) const` [inline]`, ` [noexcept]`, ` [inherited]`

Compare to a string\_view.

**Parameters**

*\_\_svt* An object convertible to string\_view to compare against.

**Returns**

Integer \< 0, 0, or \> 0.

References **std::min()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::size()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> int std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::compare (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str) const` [inline]`, ` [inherited]`

Compare to a string.

**Parameters**

*\_\_str* String to compare against.

**Returns**

Integer \< 0, 0, or \> 0.

Returns an integer \< 0 if this string is ordered before *\_\_str*, 0 if their values are equivalent, or \> 0 if this string is ordered after *\_\_str*. Determines the effective length rlen of the strings to compare as the smallest of size() and str.size(). The function then compares the two strings by calling traits::compare(data(), str.data(),rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first.

References **std::min()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::size()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, int \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::compare (size\_type \_\_pos, size\_type \_\_n, const \_Tp & \_\_svt) const` [inline]`, ` [noexcept]`, ` [inherited]`

Compare to a string\_view.

**Parameters**

*\_\_pos* A position in the string to start comparing from. \
 *\_\_n* The number of characters to compare. \
 *\_\_svt* An object convertible to string\_view to compare against.

**Returns**

Integer \< 0, 0, or \> 0.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> int std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::compare (size\_type \_\_pos, size\_type \_\_n, const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str) const` [inherited]`

Compare substring to a string.

**Parameters**

*\_\_pos* Index of first character of substring. \
 *\_\_n* Number of characters in substring. \
 *\_\_str* String to compare against.

**Returns**

Integer \< 0, 0, or \> 0.

Form the substring of this string from the *\_\_n* characters starting at *\_\_pos*. Returns an integer \< 0 if the substring is ordered before *\_\_str*, 0 if their values are equivalent, or \> 0 if the substring is ordered after *\_\_str*. Determines the effective length rlen of the strings to compare as the smallest of the length of the substring and *\_\_str.size()*. The function then compares the two strings by calling traits::compare(substring.data(),str.data(),rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first.

References **std::min()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, int \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::compare (size\_type \_\_pos1, size\_type \_\_n1, const \_Tp & \_\_svt, size\_type \_\_pos2, size\_type \_\_n2 = npos) const` [inline]`, ` [noexcept]`, ` [inherited]`

Compare to a string\_view.

**Parameters**

*\_\_pos1* A position in the string to start comparing from. \
 *\_\_n1* The number of characters to compare. \
 *\_\_svt* An object convertible to string\_view to compare against. \
 *\_\_pos2* A position in the string\_view to start comparing from. \
 *\_\_n2* The number of characters to compare.

**Returns**

Integer \< 0, 0, or \> 0.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> int std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::compare (size\_type \_\_pos1, size\_type \_\_n1, const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos2, size\_type \_\_n2 = npos) const` [inherited]`

Compare substring to a substring.

**Parameters**

*\_\_pos1* Index of first character of substring. \
 *\_\_n1* Number of characters in substring. \
 *\_\_str* String to compare against. \
 *\_\_pos2* Index of first character of substring of str. \
 *\_\_n2* Number of characters in substring of str.

**Returns**

Integer \< 0, 0, or \> 0.

Form the substring of this string from the *\_\_n1* characters starting at *\_\_pos1*. Form the substring of *\_\_str* from the *\_\_n2* characters starting at *\_\_pos2*. Returns an integer \< 0 if this substring is ordered before the substring of *\_\_str*, 0 if their values are equivalent, or \> 0 if this substring is ordered after the substring of *\_\_str*. Determines the effective length rlen of the strings to compare as the smallest of the lengths of the substrings. The function then compares the two strings by calling traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first.

References **std::min()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> \_CharT \* std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::data ()` [inline]`, ` [noexcept]`, ` [inherited]`

Return non-const pointer to contents. This is a pointer to the character sequence held by the string. Modifying the characters in the sequence is allowed.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> bool std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::empty () const` [inline]`, ` [noexcept]`

Returns true if the string is empty. Equivalent to `*this == ''`.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string\< \_CharT, \_Traits, \_Alloc \>::iterator std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::erase (iterator \_\_first, iterator \_\_last)` [inherited]`

Remove a range of characters.

**Parameters**

*\_\_first* Iterator referencing the first character to remove. \
 *\_\_last* Iterator referencing the end of the range.

**Returns**

Iterator referencing location of first after removal.

Removes the characters in the range \[first,last) from this string. The value of the string doesn't change if an error is thrown.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> iterator std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::erase (iterator \_\_position)` [inline]`, ` [inherited]`

Remove one character.

**Parameters**

*\_\_position* Iterator referencing the character to remove.

**Returns**

iterator referencing same location after removal.

Removes the character at *\_\_position* from this string. The value of the string doesn't change if an error is thrown.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, size\_type \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find (const \_Tp & \_\_svt, size\_type \_\_pos = `0`) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find position of a string\_view.

**Parameters**

*\_\_svt* The object convertible to string\_view to locate. \
 *\_\_pos* Index of character to search from (default 0).

**Returns**

Index of start of first occurrence.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos = `0`) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find position of a string.

**Parameters**

*\_\_str* String to locate. \
 *\_\_pos* Index of character to search from (default 0).

**Returns**

Index of start of first occurrence.

Starting from *\_\_pos*, searches forward for value of *\_\_str* within this string. If found, returns the index where it begins. If not found, returns npos.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::data()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, size\_type \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_not\_of (const \_Tp & \_\_svt, size\_type \_\_pos = `0`) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find position of a character not in a string\_view.

**Parameters**

*\_\_svt* An object convertible to string\_view containing characters to avoid. \
 *\_\_pos* Index of character to search from (default 0).

**Returns**

Index of first occurrence.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_not\_of()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_not\_of (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos = `0`) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find position of a character not in string.

**Parameters**

*\_\_str* String containing characters to avoid. \
 *\_\_pos* Index of character to search from (default 0).

**Returns**

Index of first occurrence.

Starting from *\_\_pos*, searches forward for a character not contained in *\_\_str* within this string. If found, returns the index where it was found. If not found, returns npos.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::data()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_not\_of()**.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_not\_of()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_not\_of()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_not\_of()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, size\_type \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_of (const \_Tp & \_\_svt, size\_type \_\_pos = `0`) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find position of a character of a string\_view.

**Parameters**

*\_\_svt* An object convertible to string\_view containing characters to locate. \
 *\_\_pos* Index of character to search from (default 0).

**Returns**

Index of first occurrence.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_of()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_of (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos = `0`) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find position of a character of string.

**Parameters**

*\_\_str* String containing characters to locate. \
 *\_\_pos* Index of character to search from (default 0).

**Returns**

Index of first occurrence.

Starting from *\_\_pos*, searches forward for one of the characters of *\_\_str* within this string. If found, returns the index where it was found. If not found, returns npos.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::data()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_of()**.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_of()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_of()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_first\_of()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, size\_type \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_not\_of (const \_Tp & \_\_svt, size\_type \_\_pos = npos) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find last position of a character not in a string\_view.

**Parameters**

*\_\_svt* An object convertible to string\_view containing characters to avoid. \
 *\_\_pos* Index of character to search back from (default end).

**Returns**

Index of last occurrence.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_not\_of()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_not\_of (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos = npos) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find last position of a character not in string.

**Parameters**

*\_\_str* String containing characters to avoid. \
 *\_\_pos* Index of character to search back from (default end).

**Returns**

Index of last occurrence.

Starting from *\_\_pos*, searches backward for a character not contained in *\_\_str* within this string. If found, returns the index where it was found. If not found, returns npos.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::data()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_not\_of()**.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_not\_of()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_not\_of()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_not\_of()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, size\_type \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_of (const \_Tp & \_\_svt, size\_type \_\_pos = npos) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find last position of a character of string.

**Parameters**

*\_\_svt* An object convertible to string\_view containing characters to locate. \
 *\_\_pos* Index of character to search back from (default end).

**Returns**

Index of last occurrence.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_of()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_of (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos = npos) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find last position of a character of string.

**Parameters**

*\_\_str* String containing characters to locate. \
 *\_\_pos* Index of character to search back from (default end).

**Returns**

Index of last occurrence.

Starting from *\_\_pos*, searches backward for one of the characters of *\_\_str* within this string. If found, returns the index where it was found. If not found, returns npos.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::data()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_of()**.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_of()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_of()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_of()**.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> reference std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::front ()` [inline]`

Returns a read/write reference to the data at the first element of the string.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> const\_reference std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::front () const` [inline]`, ` [noexcept]`

Returns a read-only (constant) reference to the data at the first element of the string.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> allocator\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::get\_allocator () const` [inline]`, ` [noexcept]`

Return copy of allocator used to construct this string.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> iterator std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert (iterator \_\_p, \_CharT \_\_c)` [inline]`, ` [inherited]`

Insert one character.

**Parameters**

*\_\_p* Iterator referencing position in string to insert at. \
 *\_\_c* The character to insert.

**Returns**

Iterator referencing newly inserted char.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Inserts character *\_\_c* at position referenced by *\_\_p*. If adding character causes the length to exceed max\_size(), length\_error is thrown. If *\_\_p* is beyond end of string, out\_of\_range is thrown. The value of the string doesn't change if an error is thrown.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<class \_InputIterator \> void std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert (iterator \_\_p, \_InputIterator \_\_beg, \_InputIterator \_\_end)` [inline]`, ` [inherited]`

Insert a range of characters.

**Parameters**

*\_\_p* Iterator referencing location in string to insert at. \
 *\_\_beg* Start of range. \
 *\_\_end* End of range.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Inserts characters in range \[\_\_beg,\_\_end). If adding characters causes the length to exceed max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> void std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert (iterator \_\_p, initializer\_list\< \_CharT \> \_\_l)` [inline]`, ` [inherited]`

Insert an initializer\_list of characters.

**Parameters**

*\_\_p* Iterator referencing location in string to insert at. \
 *\_\_l* The initializer\_list of characters to insert.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> void std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert (iterator \_\_p, size\_type \_\_n, \_CharT \_\_c)` [inline]`, ` [inherited]`

Insert multiple characters.

**Parameters**

*\_\_p* Iterator referencing location in string to insert at. \
 *\_\_n* Number of characters to insert \
 *\_\_c* The character to insert.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Inserts *\_\_n* copies of character *\_\_c* starting at the position referenced by iterator *\_\_p*. If adding characters causes the length to exceed max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert (size\_type \_\_pos, const \_Tp & \_\_svt)` [inline]`, ` [inherited]`

Insert a string\_view.

**Parameters**

*\_\_pos* Position in string to insert at. \
 *\_\_svt* The object convertible to string\_view to insert.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert (size\_type \_\_pos1, const \_Tp & \_\_svt, size\_type \_\_pos2, size\_type \_\_n = npos)` [inline]`, ` [inherited]`

Insert a string\_view.

**Parameters**

*\_\_pos1* Position in string to insert at. \
 *\_\_svt* The object convertible to string\_view to insert from. \
 *\_\_pos2* Position in string\_view to insert from. \
 *\_\_n* The number of characters to insert.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert (size\_type \_\_pos1, const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str)` [inline]`, ` [inherited]`

Insert value of a string.

**Parameters**

*\_\_pos1* Position in string to insert at. \
 *\_\_str* The string to insert.

**Returns**

Reference to this string.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Inserts value of *\_\_str* starting at *\_\_pos1*. If adding characters causes the length to exceed max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert (size\_type \_\_pos1, const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos2, size\_type \_\_n = npos)` [inline]`, ` [inherited]`

Insert a substring.

**Parameters**

*\_\_pos1* Position in string to insert at. \
 *\_\_str* The string to insert. \
 *\_\_pos2* Start of characters in str to insert. \
 *\_\_n* Number of characters to insert.

**Returns**

Reference to this string.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`. \
 *std::out\_of\_range* If *pos1* \> size() or *\_\_pos2* \> *str.size()*.

Starting at *pos1*, insert *\_\_n* character of *\_\_str* beginning with *\_\_pos2*. If adding characters causes the length to exceed max\_size(), length\_error is thrown. If *\_\_pos1* is beyond the end of this string or *\_\_pos2* is beyond the end of *\_\_str*, out\_of\_range is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::length () const` [inline]`, ` [noexcept]`

Returns the number of characters in the string, not including any null-termination.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::max\_size () const` [inline]`, ` [noexcept]`

Returns the size() of the largest possible string.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator \_\_sv\_type () const` [inline]`, ` [noexcept]`, ` [inherited]`

Convert to a string\_view.

**Returns**

A string\_view.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::data()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::size()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator+= (const \_Tp & \_\_svt)` [inline]`, ` [inherited]`

Append a string\_view.

**Parameters**

*\_\_svt* The object convertible to string\_view to be appended.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator+= (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str)` [inline]`, ` [inherited]`

Append a string to this string.

**Parameters**

*\_\_str* The string to append.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (const\_iterator \_\_i1, const\_iterator \_\_i2, const \_Tp & \_\_svt)` [inline]`, ` [inherited]`

Replace range of characters with string\_view.

**Parameters**

*\_\_i1* An iterator referencing the start position to replace at. \
 *\_\_i2* An iterator referencing the end position for the replace. \
 *\_\_svt* The object convertible to string\_view to insert from.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::begin()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<class \_InputIterator \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (iterator \_\_i1, iterator \_\_i2, \_InputIterator \_\_k1, \_InputIterator \_\_k2)` [inline]`, ` [inherited]`

Replace range of characters with range.

**Parameters**

*\_\_i1* Iterator referencing start of range to replace. \
 *\_\_i2* Iterator referencing end of range to replace. \
 *\_\_k1* Iterator referencing start of range to insert. \
 *\_\_k2* Iterator referencing end of range to insert.

**Returns**

Reference to this string.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Removes the characters in the range \[\_\_i1,\_\_i2). In place, characters in the range \[\_\_k1,\_\_k2) are inserted. If the length of result exceeds max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (iterator \_\_i1, iterator \_\_i2, const \_CharT \* \_\_s)` [inline]`, ` [inherited]`

Replace range of characters with C string.

**Parameters**

*\_\_i1* Iterator referencing start of range to replace. \
 *\_\_i2* Iterator referencing end of range to replace. \
 *\_\_s* C string value to insert.

**Returns**

Reference to this string.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Removes the characters in the range \[\_\_i1,\_\_i2). In place, the characters of *\_\_s* are inserted. If the length of result exceeds max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (iterator \_\_i1, iterator \_\_i2, const \_CharT \* \_\_s, size\_type \_\_n)` [inline]`, ` [inherited]`

Replace range of characters with C substring.

**Parameters**

*\_\_i1* Iterator referencing start of range to replace. \
 *\_\_i2* Iterator referencing end of range to replace. \
 *\_\_s* C string value to insert. \
 *\_\_n* Number of characters from s to insert.

**Returns**

Reference to this string.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Removes the characters in the range \[\_\_i1,\_\_i2). In place, the first *\_\_n* characters of *\_\_s* are inserted. If the length of result exceeds max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (iterator \_\_i1, iterator \_\_i2, const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str)` [inline]`, ` [inherited]`

Replace range of characters with string.

**Parameters**

*\_\_i1* Iterator referencing start of range to replace. \
 *\_\_i2* Iterator referencing end of range to replace. \
 *\_\_str* String value to insert.

**Returns**

Reference to this string.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Removes the characters in the range \[\_\_i1,\_\_i2). In place, the value of *\_\_str* is inserted. If the length of result exceeds max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (iterator \_\_i1, iterator \_\_i2, initializer\_list\< \_CharT \> \_\_l)` [inline]`, ` [inherited]`

Replace range of characters with initializer\_list.

**Parameters**

*\_\_i1* Iterator referencing start of range to replace. \
 *\_\_i2* Iterator referencing end of range to replace. \
 *\_\_l* The initializer\_list of characters to insert.

**Returns**

Reference to this string.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Removes the characters in the range \[\_\_i1,\_\_i2). In place, characters in the range \[\_\_k1,\_\_k2) are inserted. If the length of result exceeds max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (iterator \_\_i1, iterator \_\_i2, size\_type \_\_n, \_CharT \_\_c)` [inline]`, ` [inherited]`

Replace range of characters with multiple characters.

**Parameters**

*\_\_i1* Iterator referencing start of range to replace. \
 *\_\_i2* Iterator referencing end of range to replace. \
 *\_\_n* Number of characters to insert. \
 *\_\_c* Character to insert.

**Returns**

Reference to this string.

**Exceptions**

*std::length\_error* If new length exceeds `max_size()`.

Removes the characters in the range \[\_\_i1,\_\_i2). In place, *\_\_n* copies of *\_\_c* are inserted. If the length of result exceeds max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (size\_type \_\_pos, size\_type \_\_n, const \_Tp & \_\_svt)` [inline]`, ` [inherited]`

Replace range of characters with string\_view.

**Parameters**

*\_\_pos* The position to replace at. \
 *\_\_n* The number of characters to replace. \
 *\_\_svt* The object convertible to string\_view to insert.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (size\_type \_\_pos, size\_type \_\_n, const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str)` [inline]`, ` [inherited]`

Replace characters with value from another string.

**Parameters**

*\_\_pos* Index of first character to replace. \
 *\_\_n* Number of characters to be replaced. \
 *\_\_str* String to insert.

**Returns**

Reference to this string.

**Exceptions**

*std::out\_of\_range* If *pos* is beyond the end of this string. \
 *std::length\_error* If new length exceeds `max_size()`.

Removes the characters in the range \[\_\_pos,\_\_pos+\_\_n) from this string. In place, the value of *\_\_str* is inserted. If *\_\_pos* is beyond end of string, out\_of\_range is thrown. If the length of the result exceeds max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::append()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::insert()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, basic\_string & \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (size\_type \_\_pos1, size\_type \_\_n1, const \_Tp & \_\_svt, size\_type \_\_pos2, size\_type \_\_n2 = npos)` [inline]`, ` [inherited]`

Replace range of characters with string\_view.

**Parameters**

*\_\_pos1* The position to replace at. \
 *\_\_n1* The number of characters to replace. \
 *\_\_svt* The object convertible to string\_view to insert from. \
 *\_\_pos2* The position in the string\_view to insert from. \
 *\_\_n2* The number of characters to insert.

**Returns**

Reference to this string.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> basic\_string & std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace (size\_type \_\_pos1, size\_type \_\_n1, const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos2, size\_type \_\_n2 = npos)` [inline]`, ` [inherited]`

Replace characters with value from another string.

**Parameters**

*\_\_pos1* Index of first character to replace. \
 *\_\_n1* Number of characters to be replaced. \
 *\_\_str* String to insert. \
 *\_\_pos2* Index of first character of str to use. \
 *\_\_n2* Number of characters from str to use.

**Returns**

Reference to this string.

**Exceptions**

*std::out\_of\_range* If *\_\_pos1* \> size() or *\_\_pos2* \> \_\_str.size(). \
 *std::length\_error* If new length exceeds `max_size()`.

Removes the characters in the range \[\_\_pos1,\_\_pos1 + n) from this string. In place, the value of *\_\_str* is inserted. If *\_\_pos* is beyond end of string, out\_of\_range is thrown. If the length of the result exceeds max\_size(), length\_error is thrown. The value of the string doesn't change if an error is thrown.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::replace()**.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> void std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::reserve ()

Equivalent to shrink\_to\_fit().

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> void std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::reserve (size\_type \_\_res\_arg)

Attempt to preallocate enough memory for specified number of characters.

**Parameters**

*\_\_res\_arg* Number of characters required.

**Exceptions**

*std::length\_error* If *\_\_res\_arg* exceeds `max_size()`.

This function attempts to reserve enough memory for the string to hold the specified number of characters. If the number requested is more than max\_size(), length\_error is thrown.

The advantage of this function is that if optimal code is a necessity and the user can determine the string length that will be required, the user can reserve the memory in advance, and thus prevent a possible reallocation of memory and copying of string data.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> template\<typename \_Tp \> \_If\_sv\< \_Tp, size\_type \> std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::rfind (const \_Tp & \_\_svt, size\_type \_\_pos = npos) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find last position of a string\_view.

**Parameters**

*\_\_svt* The object convertible to string\_view to locate. \
 *\_\_pos* Index of character to search back from (default end).

**Returns**

Index of start of last occurrence.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::rfind()**.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::rfind (const basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_str, size\_type \_\_pos = npos) const` [inline]`, ` [noexcept]`, ` [inherited]`

Find last position of a string.

**Parameters**

*\_\_str* String to locate. \
 *\_\_pos* Index of character to search back from (default end).

**Returns**

Index of start of last occurrence.

Starting from *\_\_pos*, searches backward for value of *\_\_str* within this string. If found, returns the index where it begins. If not found, returns npos.

References **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::data()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::rfind()**.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::find\_last\_of()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::rfind()**, **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::rfind()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::rfind()**.

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::size () const` [inline]`, ` [noexcept]`

Returns the number of characters in the string, not including any null-termination.

### template\<typename \_CharT , typename \_Traits , typename \_Alloc \> void std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::swap (basic\_string\< \_CharT, \_Traits, \_Alloc \> & \_\_s)` [noexcept]`, ` [inherited]`

Swap contents with another string.

**Parameters**

*\_\_s* String to swap with.

Exchanges the contents of this string with that of *\_\_s* in constant time.

Referenced by **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::assign()**, and **std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::operator=()**.

## Member Data Documentation

### template\<typename \_CharT , typename \_Traits = std::char\_traits\<\_CharT\>, typename \_Allocator = std::allocator\<\_CharT\>\> const basic\_string\< \_CharT, \_Traits, \_Alloc \>::size\_type std::basic\_string\< \_CharT, \_Traits, \_Alloc \>::npos` [static]`

Value returned by various member functions when they fail.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
