std::experi..._view::rfind(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

std::experimental::basic_string_view::rfind β€” and yeah, that's the name twice, because the page says it twice: std::experimental::basic_string_view::rfind. Bestie, this one lives in the C++ Standard Libary man pages and it's a (library fundamentals TS) situation the whole way through 🧚✨


✨ Synopsis ✨

constexpr size_type rfind(basic_string_view v, size_type pos = npos) const noexcept;   (1) (library fundamentals TS)
constexpr size_type rfind(CharT c, size_type pos = npos) const noexcept;               (2) (library fundamentals TS)
constexpr size_type rfind(const CharT* s, size_type pos, size_type count) const;       (3) (library fundamentals TS)
constexpr size_type rfind(const CharT* s, size_type pos = npos) const;                 (4) (library fundamentals TS)

okay so the whole point: she finds the last substring equal to the character sequence you give her. it's giving "I'll find it, but I'm starting from the back, main character energy" πŸ’…

  1. Finds the last occurrence of v in this view, starting at position pos.
  2. Equivalent to rfind(basic_string_view(&c, 1), pos).
  3. Equivalent to rfind(basic_string_view(s, count), pos).
  4. Equivalent to rfind(basic_string_view(s), pos).
quick observation bestie: overloads (1) and (2) are the ones with const noexcept, and (3) and (4) in the synopsis do not have it. not me pointing it out, just saying πŸ‘€

πŸŽ€ Parameters πŸŽ€

  • v β€” the view you're searching for 🫢
  • pos β€” the position at which to start the search
  • count β€” length of the substring to search for
  • s β€” pointer to a character string to search for
  • ch β€” character to search for (the parameter list says ch, overload (2) up top says c, both are iconic, we hold space for both πŸ™ˆ)

🌸 Return value 🌸

Position of the first character of the found substring, or npos if no such substring is found. npos is literally the "she's not here, babe" of return values 😭

πŸ¦‹ Complexity πŸ¦‹

O(size() * v.size()) at worst. so worst case she's doing the absolute most, no cap πŸ”₯

πŸ‘‘ See also πŸ‘‘

  • find β€” find characters in the view (public member function)
  • find_first_of β€” find first occurrence of characters (public member function)
  • find_last_of β€” find last occurrence of characters (public member function)
  • find_first_not_of β€” find first absence of characters (public member function)
  • find_last_not_of β€” find last absence of characters (public member function)

⭐ Category ⭐

  • * Noindexed pages

okay that's the page, periodt πŸŽ€ this gorgeous thing came from http://cppreference.com, version 2024.06.10, and yes the whole manpage is titled std::experi..._view::rfind(3) β€” mwah, go search something backwards bestie πŸ’‹πŸŒˆ

πŸ“¦ where this page comes from