STD::EXPERIMENTAL::FILESYSTEM::BASIC_STRING_VIEW(3)

πŸ“¦
version 16.2.1+r23+gd564253eb6c8 Β· 4 versions
, in arch rolling, fedora 44

✨ NAME ✨

std::experimental::filesystem::basic_string_view< _CharT, _Traits > β€” a non-owning reference to a string.

okay so before anything else: this is a page from the Library Functions Manual, section 3, and it's about the iconic girl who looks at strings without ever owning them. she doesn't hold the data. she just points. main character energy, zero commitment. πŸ’…


🌸 SYNOPSIS 🌸

#include <>
yes bestie, that's literally what's printed on the page β€” #include <> β€” I'm not touching it, I'm just reporting what it says πŸ™ˆ

πŸŽ€ 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

twelve using aliases, all of them just vibing. the whole squad is here: iterator AND const_iterator, reverse_iterator AND const_reverse_iterator, plus all the _type girlies. no notes. 🫢

πŸ’– Public Member Functions πŸ’–

buckle up, because there are SO many of these and every single one matters. starting with the constructors:

template<contiguous_iterator _It, sized_sentinel_for< _It > _End>
    constexpr basic_string_view (_It __first, _End __last)
    noexcept(noexcept(__last - __first))
template<typename _Range, typename _DRange = remove_cvref_t<_Range>>
    constexpr basic_string_view (_Range &&__r)
    noexcept(noexcept(ranges::size(__r)) &&noexcept(ranges::data(__r)))
constexpr basic_string_view (const _CharT *__str) noexcept
constexpr basic_string_view (const _CharT *__str, size_type __len)
    noexcept
constexpr basic_string_view (const basic_string_view &) noexcept=default
basic_string_view (nullptr_t)=delete

not me spotting basic_string_view (nullptr_t)=delete in the wild β€” bestie, nullptr is deleted, it is NOT invited to the function call. πŸš«πŸ™ˆ

next up, the look-at-it-and-iterate crew:

constexpr const_reference at (size_type __pos) const
constexpr const_reference back () const noexcept
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 noexcept(false)
constexpr bool contains (_CharT __x) const noexcept
constexpr bool contains (basic_string_view __x) const noexcept
constexpr bool contains (const _CharT *__x) const noexcept
constexpr size_type copy (_CharT *__str, size_type __n, size_type
    __pos=0) const
constexpr const_reverse_iterator crbegin () const noexcept
constexpr const_reverse_iterator crend () const noexcept
constexpr const_pointer data () const noexcept
constexpr bool empty () const noexcept
constexpr const_iterator end () const noexcept

six whole compare overloads, and the last one is noexcept(false) β€” she's the one friend who might catch feelings (or throw). 😭 and at is the only one in that whole group with no noexcept, periodt.

then the entire find family, which is giving extended universe:

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 noexcept
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 noexcept
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 noexcept
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 noexcept
constexpr size_type find_last_of (const _CharT *__str, size_type
    __pos=npos) const noexcept

four overloads each, five families, twenty signatures total. every. single. one. noexcept. she does not throw, she does not stress, she does not miss. 🧚

and the final batch β€” the observers, the operators, and the little slice-and-dice besties:

constexpr const_reference front () const noexcept
constexpr size_type length () const noexcept
constexpr size_type max_size () const noexcept
constexpr basic_string_view & operator= (const basic_string_view &)
    noexcept=default
constexpr const_reference operator[] (size_type __pos) const noexcept
constexpr const_reverse_iterator rbegin () const noexcept
constexpr void remove_prefix (size_type __n) noexcept
constexpr void remove_suffix (size_type __n) noexcept
constexpr 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 noexcept(false)
constexpr basic_string_view subview (size_type __pos=0, size_type
    __n=npos) const
constexpr void swap (basic_string_view &__sv) noexcept

substr is noexcept(false) and subview has no noexcept at all β€” so if you're keeping score, those two are the risky ones, bestie. everyone else said "I don't throw" out loud. πŸ’€

also operator= is =default, remove_prefix and remove_suffix return void, and swap takes a basic_string_view &__sv. tiny. perfect. no crumbs.

⭐ Static Public Attributes ⭐

static constexpr size_type npos

one static attribute, and it's THE one: npos. she's everywhere in those default arguments up there and she knows it. πŸ‘‘


πŸ¦‹ Detailed Description πŸ¦‹

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
    class std::experimental::filesystem::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

that's the whole entire vibe, fr fr: a pointer and a length. two little members. that's the girl. she's non-owning, she's constexpr, and she's out here doing the absolute most with the absolute least. 🌈


πŸ‘‘ Author πŸ‘‘

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


and that's the page, bestie πŸŽ€ β€” straight from libstdc++, filed under std::exper..., _Traits >(3) in the Library Functions Manual. no notes, she ate, periodt. πŸ’–βœ¨πŸ¦‹

πŸ“¦ 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.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