STD::EXPERIMENTAL::BASIC_STRING_VIEW(3)
π std::experimental::basic_string_view< _CharT, _Traits > π
okay bestie, welcome to the Library Functions Manual section three, and lemme tell you about the absolute icon that is std::experimental::basic_string_view< _CharT, _Traits >. no cap, she's THAT girl. π
β¨ NAME β¨
std::experimental::basic_string_view< _CharT, _Traits > β a non-owning reference to a string. that's it, that's the whole vibe. she looks at strings, she does not own them, she does not take responsibility for their lives. main character energy but make it borrowed. π
πΈ SYNOPSIS πΈ
#include <>>
ngl that include line is looking a little mysterious today but I'm telling you exactly what the page says, fr fr. π«Ά
π Public Types
here's her whole closet of type aliases, and yes she has range:
const_iteratorconst_pointerconst_referenceconst_reverse_iteratordifference_typeiteratorpointerreferencereverse_iteratorsize_typetraits_typevalue_type
π« Public Member Functions
sit down, hydrate, this list is LONG and she ate every single time:
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) noexceptconstexpr basic_string_view (const basic_string_view &) noexcept=defaultconstexpr const _CharT & at (size_type __pos) constconstexpr const _CharT & back () constconstexpr const_iterator begin () const noexceptconstexpr const_iterator cbegin () const noexceptconstexpr const_iterator cend () const noexceptconstexpr int compare (basic_string_view __str) const noexceptconstexpr int compare (const _CharT *__str) const noexceptconstexpr int compare (size_type __pos1, size_type __n1, basic_string_view __str) constconstexpr int compare (size_type __pos1, size_type __n1, basic_string_view __str, size_type __pos2, size_type __n2) constconstexpr int compare (size_type __pos1, size_type __n1, const _CharT *__str) constconstexpr int compare (size_type __pos1, size_type __n1, const _CharT *__str, size_type __n2) constsize_type copy (_CharT *__str, size_type __n, size_type __pos=0) constconst_reverse_iterator crbegin () const noexceptconst_reverse_iterator crend () const noexceptconstexpr const _CharT * data () const noexceptconstexpr bool empty () const noexceptconstexpr const_iterator end () const noexceptconstexpr size_type find (_CharT __c, size_type __pos=0) const noexceptconstexpr size_type find (basic_string_view __str, size_type __pos=0) const noexceptconstexpr size_type find (const _CharT *__str, size_type __pos, size_type __n) const noexceptconstexpr size_type find (const _CharT *__str, size_type __pos=0) const noexceptconstexpr size_type find_first_not_of (_CharT __c, size_type __pos=0) const noexceptconstexpr size_type find_first_not_of (basic_string_view __str, size_type __pos=0) const noexceptconstexpr size_type find_first_not_of (const _CharT *__str, size_type __pos, size_type __n) constconstexpr size_type find_first_not_of (const _CharT *__str, size_type __pos=0) const noexceptconstexpr size_type find_first_of (_CharT __c, size_type __pos=0) const noexceptconstexpr size_type find_first_of (basic_string_view __str, size_type __pos=0) const noexceptconstexpr size_type find_first_of (const _CharT *__str, size_type __pos, size_type __n) constconstexpr size_type find_first_of (const _CharT *__str, size_type __pos=0) const noexceptconstexpr size_type find_last_not_of (_CharT __c, size_type __pos=npos) const noexceptconstexpr size_type find_last_not_of (basic_string_view __str, size_type __pos=npos) const noexceptconstexpr size_type find_last_not_of (const _CharT *__str, size_type __pos, size_type __n) constconstexpr size_type find_last_not_of (const _CharT *__str, size_type __pos=npos) const noexceptconstexpr size_type find_last_of (_CharT __c, size_type __pos=npos) const noexceptconstexpr size_type find_last_of (basic_string_view __str, size_type __pos=npos) const noexceptconstexpr size_type find_last_of (const _CharT *__str, size_type __pos, size_type __n) constconstexpr size_type find_last_of (const _CharT *__str, size_type __pos=npos) const noexceptconstexpr const _CharT & front () constconstexpr size_type length () const noexceptconstexpr size_type max_size () const noexcepttemplate<typename _Allocator> operator basic_string< _CharT, _Traits, _Allocator > () constbasic_string_view & operator= (const basic_string_view &) noexcept=defaultconstexpr const _CharT & operator[] (size_type __pos) constconst_reverse_iterator rbegin () const noexceptconstexpr void remove_prefix (size_type __n)constexpr void remove_suffix (size_type __n)const_reverse_iterator rend () const noexceptconstexpr size_type rfind (_CharT __c, size_type __pos=npos) const noexceptconstexpr size_type rfind (basic_string_view __str, size_type __pos=npos) const noexceptconstexpr size_type rfind (const _CharT *__str, size_type __pos, size_type __n) const noexceptconstexpr size_type rfind (const _CharT *__str, size_type __pos=npos) const noexceptconstexpr size_type size () const noexceptconstexpr basic_string_view substr (size_type __pos=0, size_type __n=npos) constconstexpr void swap (basic_string_view &__sv) noexcepttemplate<typename _Allocator = std::allocator<_CharT>> basic_string< _CharT, _Traits, _Allocator > to_string (const _Allocator &__alloc=_Allocator()) const
like??? the range??? the versatility??? she does find, she does rfind, she does find_first_of, she does find_last_not_of, she does it ALL. π
β Static Public Attributes
one (1) static attribute, and she's iconic for it:
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 tochar_traits<_CharT>. slay, she comes with a default. π«Ά
a basic_string_view looks like this, and honestly? the way that it's just two little fields is SO satisfying:
_CharT* _M_str
size_t _M_len
that's the whole struct bestie. a pointer and a length. no heap allocation, no drama, no mess. she's literally just β¨pointingβ¨ at somebody else's string and saying "yeah I know her." the audacity, the elegance, the non-owning of it all. π
π Author π
generated automatically by Doxygen for libstdc++ from the source code. not me getting emotionally attached to a machine-generated doc but here we are. π
and that's the page!! π remember: this whole thing lives in the Library Functions Manual, it's the libstdc++ std::exper..., _Traits >(3) page, and yes the title is genuinely abbreviated like that, we love a mysterious queen. go forth and view strings without owning them, bestie. πβ¨π¦
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms