---
name: "std::experimental::basic_string_view"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::experimental::basic_string_view"
---

# std::experimental::basic\_string\_view(3)

A non-owning reference to a string.

## NAME

std::experimental::basic\_string\_view\< \_CharT, \_Traits \> - A non-owning reference to a string.

## SYNOPSIS

\#include \<\>\>

### Public Types

using **const\_iterator**\
 using **const\_pointer**\
 using **const\_reference**\
 using **const\_reverse\_iterator**\
 using **difference\_type**\
 using **iterator**\
 using **pointer**\
 using **reference**\
 using **reverse\_iterator**\
 using **size\_type**\
 using **traits\_type**\
 using **value\_type**\

### Public Member Functions

constexpr **basic\_string\_view** (const \_CharT \*\_\_str)\
 constexpr **basic\_string\_view** (const \_CharT \*\_\_str, size\_type \_\_len)\
 template\<typename \_Allocator\> **basic\_string\_view** (const **basic\_string**\< \_CharT, \_Traits, \_Allocator \> &\_\_str) noexcept\
 constexpr **basic\_string\_view** (const basic\_string\_view &) noexcept=default\
 constexpr const \_CharT & **at** (size\_type \_\_pos) const\
 constexpr const \_CharT & **back** () const\
 constexpr const\_iterator **begin** () const noexcept\
 constexpr const\_iterator **cbegin** () const noexcept\
 constexpr const\_iterator **cend** () const noexcept\
 constexpr int **compare** (basic\_string\_view \_\_str) const noexcept\
 constexpr int **compare** (const \_CharT \*\_\_str) const noexcept\
 constexpr int **compare** (size\_type \_\_pos1, size\_type \_\_n1, basic\_string\_view \_\_str) const\
 constexpr int **compare** (size\_type \_\_pos1, size\_type \_\_n1, basic\_string\_view \_\_str, size\_type \_\_pos2, size\_type \_\_n2) const\
 constexpr int **compare** (size\_type \_\_pos1, size\_type \_\_n1, const \_CharT \*\_\_str) const\
 constexpr int **compare** (size\_type \_\_pos1, size\_type \_\_n1, const \_CharT \*\_\_str, size\_type \_\_n2) const\
 size\_type **copy** (\_CharT \*\_\_str, size\_type \_\_n, size\_type \_\_pos=0) const\
 const\_reverse\_iterator **crbegin** () const noexcept\
 const\_reverse\_iterator **crend** () const noexcept\
 constexpr const \_CharT \* **data** () const noexcept\
 constexpr bool **empty** () const noexcept\
 constexpr const\_iterator **end** () const noexcept\
 constexpr size\_type **find** (\_CharT \_\_c, size\_type \_\_pos=0) const noexcept\
 constexpr size\_type **find** (basic\_string\_view \_\_str, size\_type \_\_pos=0) const noexcept\
 constexpr size\_type **find** (const \_CharT \*\_\_str, size\_type \_\_pos, size\_type \_\_n) const noexcept\
 constexpr size\_type **find** (const \_CharT \*\_\_str, size\_type \_\_pos=0) const noexcept\
 constexpr size\_type **find\_first\_not\_of** (\_CharT \_\_c, size\_type \_\_pos=0) const noexcept\
 constexpr size\_type **find\_first\_not\_of** (basic\_string\_view \_\_str, size\_type \_\_pos=0) const noexcept\
 constexpr size\_type **find\_first\_not\_of** (const \_CharT \*\_\_str, size\_type \_\_pos, size\_type \_\_n) const\
 constexpr size\_type **find\_first\_not\_of** (const \_CharT \*\_\_str, size\_type \_\_pos=0) const noexcept\
 constexpr size\_type **find\_first\_of** (\_CharT \_\_c, size\_type \_\_pos=0) const noexcept\
 constexpr size\_type **find\_first\_of** (basic\_string\_view \_\_str, size\_type \_\_pos=0) const noexcept\
 constexpr size\_type **find\_first\_of** (const \_CharT \*\_\_str, size\_type \_\_pos, size\_type \_\_n) const\
 constexpr size\_type **find\_first\_of** (const \_CharT \*\_\_str, size\_type \_\_pos=0) const noexcept\
 constexpr size\_type **find\_last\_not\_of** (\_CharT \_\_c, size\_type \_\_pos=npos) const noexcept\
 constexpr size\_type **find\_last\_not\_of** (basic\_string\_view \_\_str, size\_type \_\_pos=npos) const noexcept\
 constexpr size\_type **find\_last\_not\_of** (const \_CharT \*\_\_str, size\_type \_\_pos, size\_type \_\_n) const\
 constexpr size\_type **find\_last\_not\_of** (const \_CharT \*\_\_str, size\_type \_\_pos=npos) const noexcept\
 constexpr size\_type **find\_last\_of** (\_CharT \_\_c, size\_type \_\_pos=npos) const noexcept\
 constexpr size\_type **find\_last\_of** (basic\_string\_view \_\_str, size\_type \_\_pos=npos) const noexcept\
 constexpr size\_type **find\_last\_of** (const \_CharT \*\_\_str, size\_type \_\_pos, size\_type \_\_n) const\
 constexpr size\_type **find\_last\_of** (const \_CharT \*\_\_str, size\_type \_\_pos=npos) const noexcept\
 constexpr const \_CharT & **front** () const\
 constexpr size\_type **length** () const noexcept\
 constexpr size\_type **max\_size** () const noexcept\
 template\<typename \_Allocator\> **operator basic\_string\< \_CharT, \_Traits, \_Allocator \>** () const\
 basic\_string\_view & **operator=** (const basic\_string\_view &) noexcept=default\
 constexpr const \_CharT & **operator\[\]** (size\_type \_\_pos) const\
 const\_reverse\_iterator **rbegin** () const noexcept\
 constexpr void **remove\_prefix** (size\_type \_\_n)\
 constexpr void **remove\_suffix** (size\_type \_\_n)\
 const\_reverse\_iterator **rend** () const noexcept\
 constexpr size\_type **rfind** (\_CharT \_\_c, size\_type \_\_pos=npos) const noexcept\
 constexpr size\_type **rfind** (basic\_string\_view \_\_str, size\_type \_\_pos=npos) const noexcept\
 constexpr size\_type **rfind** (const \_CharT \*\_\_str, size\_type \_\_pos, size\_type \_\_n) const noexcept\
 constexpr size\_type **rfind** (const \_CharT \*\_\_str, size\_type \_\_pos=npos) const noexcept\
 constexpr size\_type **size** () const noexcept\
 constexpr basic\_string\_view **substr** (size\_type \_\_pos=0, size\_type \_\_n=npos) const\
 constexpr void **swap** (basic\_string\_view &\_\_sv) noexcept\
 template\<typename \_Allocator = std::allocator\<\_CharT\>\> **basic\_string**\< \_CharT, \_Traits, \_Allocator \> **to\_string** (const \_Allocator &\_\_alloc=\_Allocator()) const\

### Static Public Attributes

static constexpr size\_type **npos**\

## Detailed Description

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

class std::experimental::basic\_string\_view\< \_CharT, \_Traits \>"A non-owning reference to a string.

**Template Parameters**

*\_CharT* Type of character \
 *\_Traits* Traits for character type, defaults to char\_traits\<\_CharT\>.

A basic\_string\_view looks like this:

```
_CharT*    _M_str
size_t     _M_len
```

## Author

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